Print Usertypes on their profiles?

13 years 7 months ago #11128 by tulula3
I've been trying to get into joomla and it's inner workings to something I think should be quite simple.

How would a person print on each of the viewed profiles what their usertype is? OR MORE specifically:

- If usertype is: Registered, then print "This is a Member of this website"
- IF usertype is: Manager, then print "This is a Business Member of this website"

I tried many different things in community builder but nothing is working out and I'm more of a programmer "ripper" than a programmer from the ground up or from scratch.

Please help asap!
13 years 7 months ago #11604 by centralpulse
This isn't exactly what your looking for but it will give you a start. When a profile page is visited this code will display the usertype from the Joomla database for the user whos profile is being viewed.
I have had a quick look at assigning a different value to the usertypes (e.g. 'Business Member' instead of 'Manager') but I will need more time to work it out if I'm able to work it out. You can see a demo of the existing code below by viewing and
(Please note: registration is disabled on this website as it is a work in progress, the code will be removed from the site sometime on 8 May 2006 New Zealand Standard Time as it's not appropriate for this website)

Define the location of the information in the menu file located in components/com_comprofiler/plugin/user/plug_cbmenu/

Open the file and under '// Build basic menu:' add the following at the bottom:
[code:1]$usertype = ".$user->usertype";[/code:1]
Now at the end of the the section '// Last Updated' we are creating a new section so you need to add the following after the

'// Last Updated' section:
[code:1]// Profile Usertype
if ($params->get('usertype', '1')==1) {
$mi = array(); $mi["_UE_MENU_STATUS"]["_UE_USERTYPE"]["_UE_USERTYPE"]=null;
$this->menuList->addObjectItem($mi, "$user->usertype member","","",
"","", "",""«»);
You may want to replace the 2 parts saying _UE_USERTYPE with your own text or edit the language file.

Save the file. Please remember to back up all files before beginning work on them so if something does go wrong (it shouldn't but strange things sometimes do happen) you can fix it by replacing your 'hacked' file with your back up version.

Let me know how it goes,
Ryan B)

13 years 7 months ago #11634 by tulula3
Thanks for your insight and code!

I've actually taken a completely new direction with community builder, user tables and database mapping fields with the use of agilebill/ I was using it for just business registration and was having trouble managing fields be touched or protected so now am pumping ALL registrations through it.

In order to fix the trouble above (and fix other limitations on my site using solely community builder), I set up all registration fields as extra fields in the #__users table, IE, 'membertype', 'address', 'city', 'province', 'country' etc.

Agilebill syncs fields with this table when people have paid, etc for different products/services/descriptions - AND I have it talking to other external php scripts on my domain as well. So now, when a registered user signs up through agilebill, it'll toss into my "membertype" field what i mapped it to say whether it's "This is a Registered User" or "This is a Business User" depending on their registration subscription upon sign up there.

The fields now can ONLY be managed through agilebill as I also was having an issue of field protection/write access by usertype, I set them all in #__comprofiler_fields to point to #__users AND those fields are read only=1 so no updates CAN be made in Joomla for basic registration fields.

Was a great solution for the needs of my site...


Post edited by: tulula3, at: 2006/05/05 18:54
13 years 7 months ago #11734 by centralpulse
I'm glad that you found a solution that suited your needs :) It's an interesting solution at that.

For all others I have now removed the usertype fields from the site that they were on so if you want to see them you're going to have to impliment the script on your own sites.

Ryan B)

Moderators: beatnantkrileon
Time to create page: 0.389 seconds

Facebook Twitter LinkedIn