Community Builder & Joomla.. help with code

Discussion and education for beginner / novice programmers interested in embarking on the development process to take advantage of the extensible nature of the Joomla! CMS.

Moderators: tjay, seadap, Rogue4ngel, matthewhayashida

Forum rules
Post Reply
designbyjryan
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Sat Oct 06, 2007 1:06 pm

Community Builder & Joomla.. help with code

Post by designbyjryan » Sat Oct 13, 2007 5:28 am

Using the community builder extension, I have a list of 20+ genres of music.  When a user registers or edits their profile they can select a genre that they choose. 

How can I perpetually make every user who has not uploaded an mp3 to their profile, a FAN ONLY. 

That is, I want to only let those who upload music select a genre, and everyone else is has to default to a FAN ONLY status (or genre)

Anyone have any helpful insight? I'm stuck.

User avatar
bascherz
Joomla! Intern
Joomla! Intern
Posts: 86
Joined: Mon Jan 16, 2006 1:33 am
Location: Vienna, VA
Contact:

Re: Community Builder & Joomla.. help with code

Post by bascherz » Sat Oct 13, 2007 1:25 pm

designbyjryan wrote:How can I perpetually make every user who has not uploaded an mp3 to their profile, a FAN ONLY. 

That is, I want to only let those who upload music select a genre, and everyone else is has to default to a FAN ONLY status (or genre)

Anyone have any helpful insight? I'm stuck.

CB has no built-in file upload capability other than the user's image (avatar). Therefore, you will first need a means of allowing users to upload a file other than an image. Presumably, you will want this audio played (once or repeatedly) when someone visits the user's profile, so there will need to be code that runs when a user's profile is displayed that will play the audio file whose name is stored in the CB database table jos_comprofiler. Once an MP3 file name exists for a given user's profile, you want the user's status raised from FAN ONLY to something higher-level.

CB can handle all of this through its built-in plug-in extendability. Everything you need can be triggered by different events with which the plug-in can register functions to be called upon occurrence. This will require a slight bit of coding and some clever integration of existing CB plug-ins. I believe I identified all the plug-ins you'd need to do this with minimal (perhaps no) coding. You should visit the Joomla Extensions website and look in the Community Builder Plugins category. Since you did not mention what portion of this you already have in place, I suggest you start there and see what you can piece together. You may need a combination of GPL/free and commercially-licensed extensions.

Hope this helps.
__________________
Bruce Scherzinger

designbyjryan
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Sat Oct 06, 2007 1:06 pm

Re: Community Builder & Joomla.. help with code

Post by designbyjryan » Sat Oct 13, 2007 8:58 pm

Thanks for you help.

I actually have quite a bit of this implemented and working.

If you can go here and take a look: http://risingsuperstar.com/rss_dev/component/option,com_comprofiler/task,usersList/listid,2/Itemid,26/

What would i need to do to filter these results, not only by category, but also by 'has uploaded song'?  Would that be a SQL query I need to add to the releated CB php file/function?

There is just so much that Community Builder seems to already do for you, I just don't know where to start. This project is something I just took over, and there is no organization to it at all.

Any insight would be helpful.

Thank in advance,

Ryan

User avatar
bascherz
Joomla! Intern
Joomla! Intern
Posts: 86
Joined: Mon Jan 16, 2006 1:33 am
Location: Vienna, VA
Contact:

Re: Community Builder & Joomla.. help with code

Post by bascherz » Sat Oct 13, 2007 9:24 pm

No. What you need to do is create a CB checkbox field that is not user-writable but rather is set by the extension that uploads the MP3 file or by a CB plug-in that knows where it is. One way or another, some software needs to write a '1' to this CB checkbox field. The easiest way (without hacking) would be to write a CB plug-in that knows where each user's media file is stored, check to see if one is there, and if so set this field to a '1' if the file exists and to a '0' if not. This would be registered to the CB event that is triggered when a user profile is displayed, so it would not get updated until someone visits each user's profile (or you might be able to write a SQL query to populate the field initially). Then you can filter on that field in your user directory.

Writing a CB plug-in is pretty easy to do. The needed documentation is on the joomlapolis website.
Last edited by bascherz on Sat Oct 13, 2007 9:25 pm, edited 1 time in total.
__________________
Bruce Scherzinger


Post Reply