Hi Herve,
Thank you for reminding.I will give it another shot tomorrow and post back.
Regards
BrajeshHi Herve,
Remove all the code(take a backup).Use the following code
1. It will change member type to ‘member0’ when all conditions matches. The conditions are
a. User must have a photo
b). User must have all required fields
c). User should have the field with id ’57′(or change it) and its value as “Une Femme” as per your post.Once a user’s role changes, It does not remove the role. If you want to remove, Pleases do that in mark_incomplete function.
Regards
BrajeshHi
Thank you I understand why it has been long. You wanted to completely change your first function!!
Now I am very embarrassed because I did not want to change it (it seems to work well).I just wanted a correction of my program prov_transfert($user_login, $user) [in wp_login] that did not work 🙁
As we have trouble understanding ourselves, I did not want detailed. I then want to do several small functions for different cases.
RegardsHi Herve,
to be honest, I have no idea what worked in the first and what did not. That’s why I tried to rewrite it.As per your previous message
The idea is at the moment of connection (That’s when I can not do it, I think), check if the member has
* a photo
* all mandatory fields filled
* a subscriber role
* a special value for an xprofile fieldIf yes I change the role of the member (member0)
I made it such.
What changes do you want in this. Please do know that like I explained earlier, I am unable to work with parts. The code you had supplied was using incorrect variable($this outside the class scope, $bp without declaring global).
Can you please tell me the issue you are facing with the above code. It is just an upgrade of the previous code and as per your requirement, It does change the role.
Thank you
BrajeshI,
In fact
Your first code works well
My code does not work He does not do the role change
I wanted to have a function at the time of the connection (event: wp_login?), Which1 / tests the variables (equivalent of your program that works) of a member who connects and who does not have the right role (I can not explain why because it would be difficult):
a) User must have a photo
b) User must have all required fields
c) subscriber rôle
…2/ If everything is ok, the member moves to the new role
RegardsCan you please take backup of the first code and try it.
It does exactly that.
Also, I am still not sure what a connection is but it works by checking on each page load. since it uses the logged in user’s user meta for checking, The impact on performance will be neglible.
Login is just one of the events where profile status changes. The profile status may also change on photo upload/delete or profile filed update.
Regards
BrajeshHello Brajesh
Unfortunately it does not work!
I do not have an error message After a new registration, I do not have a message telling me that I did not fill in the required fields or the photo.
I put my code https://gist.github.com/sbrajesh/3d7ab3f50dff9bc1ef2df1e9c5a28c53 with my previous modifications of the old programTo avoid complicating, I unfortunately did not explain that I wanted to make a second program that uses your first program (a member must always have entered all the fields and put his picture).
I do not want to modify your program or ask you (several times) to modify it so as not to disturb youThis 2nd program will be the basis of many others that I must be able to do alone
Today your program is working well
Tomorrow I want to use your program class BuddyDev_Profile_Field_Completion_Helper (improved?) AND function change
I will need to create and modify small programs function change1, function change2 …. for different contexts. examples (I know it’s not a valid code, just structures)
CODE:IF the member has entered all the required fields and upload his photo (it's a simple!? Check after using class BuddyDev_Profile_Field_Completion_Helper , to avoid giving rights.If it's too complicated, it is possible not to do the test add_action('wp_login', 'change1', '99', 2); function change1($user_login, $user) { $user_id = $user->ID; $field_jesuis = '57'; $jesuis = xprofile_get_field_data($field_jesuis,$bp->loggedin_user->id ); // $user_id ); if ( $user->has_cap('membre0') && ($jesuis='Une Femme')) { .. do_action ... $user_id->add_role( 'membre1' ); } } add_action('wp_login', 'change2', '99', 2); function change2($user_login, $user) { $user_id = $user->ID; $field_XYZ = 'XYZ'; $XYZ = xprofile_get_field_data($field_XYZ,$bp->loggedin_user->id ); // $user_id ); if ( $user->has_cap('membre1') && ($XYZ='fsdfdsfd')) { .. do_action ... $user_id->add_role( 'membre2' ); } } IF END
My 2 problems were to a) test the role at the connection of a member and b) if possible to check at the same time the mandatory entries
If you want to stop, I understand.
Otherwise please tell me how I can integrate very simply these different functions in your program (no risk of problem) or so give me the CODE
Thanks- This reply was modified 6 years, 6 months ago by Hervé.
Hi Herve,
I am sorry but I don’t think I will be able to assist you on this.For me, as I said earlier, the solutions provided are very specific to what you mention. In some of the cases, they may act as a general solution but most of the time they will break.
In your case, even after so many days, I am still not sure, what exactly you are looking for.
The latest solution is tested to change the the role on completion.
Here is teh notice on BuddyPress 2.9
https://i.imgur.com/FQcmNH5.pngand on BuddyPress 3.0
https://i.imgur.com/LVWiwJM.png
Regards
Brajesh
You must be logged in to reply to this topic.