فتحات العرب Joomla! • Index page: General Questions/New to Joomla! 2.5 • Re: Prevent users changing "Name" in "Edit Your Profile"

Saturday, January 31, 2015

General Questions/New to Joomla! 2.5 • Re: Prevent users changing "Name" in "Edit Your Profile"

Sorry to bring back this old topic, but I am looking to add a field too the profile page where you can fiew a specific record, or coloum in the row for the user.



I want to be able to display the data for that users specific field, just as plain text (not editable),

I tried to do into the edit.php file in /public_html/components/com_users/views/profile/tmpl but the php I put in breaks the page. not sure how to access the database with out interfering with the flow of the components.



$db = JFactory::getDbo();

$query = $db->getQuery(true);

//select used to select from one or more tables

$query->select('name')

//from is the table

->from($db->quoteName('#__users'))

//where is the row

->where($db->quoteName('id').'=771');

$db->setQuery($query);

$my_value = $db->loadResult();



echo $my_value;



Although this code gets the name in theory, and even on the home page it works in a regular index.php file. When I try to insert it into edit.php the whole page breaks. Either it shows a page where it has the profile fields but nothing else (as in, no header, no banner no menu, literally a blank page with some input boxes) or the page doesn't show the profile, just blank in the content part.



I am novice and would like to know how to accomplish this.

Any help out there?

Statistics: Posted by beaudoiin — Sat Jan 31, 2015 3:32 pm








via Joomla! http://ift.tt/1AbhbTr

No comments:

Post a Comment