Forums

Profile Plugin Menu Link [Registered Users]

cf_jamo 15 Dec, 2010
Hi Guys,
I was wondering how do i create a link on the main menu such that registered users are able to edit their profiles. i have setup and enabled the profile plugin like this index.php?option=com_chronocontact&chronoformname=registration&user_id=64 and it works, my only problem is that anyone can guess a user id and have access to other isers information.
Does anyone have a clue on how to do this or atleast direct me to somewhere i can get help,

Cheers
James
GreyHead 15 Dec, 2010
Hi James,

I think that if you leave "Request parameter name" empty in the Profile Page plug-in configuration then it will default to the User ID. This way you should be able to use a generic menu link and the current User Id will effectively be auto-completed.

Bob
cf_jamo 15 Dec, 2010
Thanks Greyhead,
Am not understanding what you mean, i left the request parameter blank then selected chronoforms as the menu type but it says "You can not re-register while you are already signed in" when i click on the menu, what am i missing?
GreyHead 15 Dec, 2010
Hi cf_jamo,

That message sounds as though you have the Joomla! Registration plug-in enabled?

Bob
cf_jamo 15 Dec, 2010
yes the joomla plugin is enabled thus the purpose for the profile plugin, in order to enable registered user to edit their own details. i would buy you a beer greyhead if your coming to Kenya this time of year since we are enjoying a lot of sun, its like 2:20 AM when am writing this and its 15c....
anyway i would really appreciate if you direct me in the right direction.😀
GreyHead 16 Dec, 2010
Jambo Habari cf_jamo,

Yes but once they are registered you don't want to register them again. To let them edit their details make a copy of the form without the Registration plug-in.

At the moment there is no easy way to prevent a plug-in from running so you can't turn it off for registered users and leave it on for new users.

Bob

PS There is more about this in the 33 page How-to document I have for sale here
cf_jamo 16 Dec, 2010
Thanks alot greyhead,
I got it working!😀 whenever your in this part of Africa holler at me, i owe you a crate of beer.
davidp_vaz@web.de 05 Jan, 2011
Hi Greyhead,

right now i have the same problem as described above. I created a form which will show the user details after login so that the user can edit them by himself. If i enter in 'Request' parameter name
the ID of an existing user all the data are shown. But i also want this to happen dynamically.
What do you mean with "generic menu link"

Regards David
davidp_vaz@web.de 05 Jan, 2011
Hi

solved: In my case the id was the problem. I just searched in the profil plugin file (cf_profile.php)
the code section:

} else {
$record_id = $my->id;
if ( $record_id == 0 ) {
//$record_id = '##guest##';
}
and add the red code:

} else {
$record_id = $my->id;
echo "$record_id";
if ( $record_id == 0 ) {
//$record_id = '##guest##';
}

so after reloading the page you will see which "id" is used to identify the record. Finally found my bug in "profil page" plugin settings. I choosed the wrong "Target field name".
I hope its ok if i post changes in the code to debug a problem otherwise please delete this post.
Thanks for this cool component!!

Now 1 prob. is left: Changes in the record data won't be saved to the database?
davidp_vaz@web.de 05 Jan, 2011
Hi

back again last problem solved. Found this post:
http://www.chronoengine.com/forums/index.php?option=com_chronoforums&cont=posts&f=2&t=19108&p=56694&hilit=profile+plugin#p56694

Just add a on your form a textbox and enter to property "fieldname" "id" or the primarykey name, save the form. Then edit the form, tab "form code", open "form html" and add the following red code to the inputfield of the id:
<input class="cf_inputbox" style="display: none;" maxlength="150" size="30" title="" id="text_9" name="id" type="text" />

thats it now the record should be saved :-)

Regards David
GreyHead 06 Jan, 2011
Hi David,

Here's the code to add the current user id to a form as a hidden input.
<?php
$user =& JFactory::getUser();
?>
. . .
<input type='hidden' name='cf_user_id' id='cf_user_id' value='<?php echo $user->id; ?>' />


Bob

PS This is a snippet from a long document on creating, editing and saving user info that is available for sale here.
Bernoe 11 Aug, 2011

Here's the code to add the current user id to a form as a hidden input.


This hasn't worked for me. It says that the form input is invalid.
GreyHead 11 Aug, 2011
Hi Bernoe,

Eh? What says that the form input is invalid?

Bob
This topic is locked and no more replies can be posted.