Bigint
Forum Replies Created
-
Hi Champ Camba,
Unfortunately, the code does’nt work.
When I added my original code that uses the pending function it also set admin to awaiting admin review which locked me out unless I added (if is super admin) first. I did not want that to happen so I added (if is super admin) to your code – below.
// Set profile to under review after edits add_action('um_user_edit_profile', 'um_post_edit_pending_hook', 10, 2); function um_post_edit_pending_hook(){ $user_id = um_get_requested_user(); if ( is_super_admin() ) { return false; } else { update_user_meta( $user_id, 'account_status', 'awaiting_admin_review'); } }
When that did not work I just ran your code. The code doesn’t break the site, but the user account status does not change when users make edits.
Any more ideas please and thanks for your time.
Hi Champ Camba,
Thank you, very much, for taking the time to read my post and reply.
Over the weekend I thought about hooking into the ‘um_submit_form_profile’ action, but I haven’t tried that yet.
However, your approach looks much more appropriate. I’m going to try it now.
Thanks again, your support is much appreciated.
Hi,
So, I figured out that the pending function does not only set the status of users to pending, but it sends an email too. So, I presume my hook is being called at registration.
What I want to do is just set the status of users to pending without sending the email. I looked into the pending function in greater detail and noticed that the following line actually looks to set users to pending
$this->set_status('awaiting_admin_review');
.Therefore, I have tried to use that line alone in a hook into the ‘um_user_edit_profile’ action (shown below) – but it doesn’t work.
I think I’m nearly there. Can anyone please point out why the hook is breaking the site?
// Set profile to under review after edits add_action('um_user_edit_profile', 'um_post_edit_pending_hook', 10, 2); function um_post_edit_pending_hook(){ if ( is_super_admin() ) { return false; } else { global $ultimatemember; $ultimatemember->set_status('awaiting_admin_review'); } }
Hi,
I deactivated and activated some WC plugins, it seems to be working now.
Are there any docs though still?
Thanks.
PS. Is there something I need to do in WooCommerce Coupon sections, because I cannot find your plugin mentioned in that section. Or, should the plugin take care of everything on it’s own?
Thanks
Hi,
If you used the above code to set users to pending and admin was set to pending, login as admin and use this snippet in your child theme functions to set admin back to approve when a profile is edited.
add_action('um_user_edit_profile', 'um_post_edit_pending_hook', 10, 2); function um_post_edit_pending_hook($user_id, $args){ global $ultimatemember; $ultimatemember->user->approve(); }
You must be logged in under the account for it to work. If you can’t login use FTP to disable the plug-in , then copy it back and run the code.
Right, the below code is what I should have added originally. It queries whether the user is admin first, if the user is ‘not’ admin the profile is set to pending. If the user is admin nothing happens.
add_action('um_user_edit_profile', 'um_post_edit_pending_hook', 10, 2); function um_post_edit_pending_hook($user_id, $args){ if ( is_super_admin() ) { return false; } else { global $ultimatemember; $ultimatemember->user->pending(); } }
Hi,
DONT USE THE ACTION TO SET USERS TO PENDING APPROVAL AFTER EDITS!!!
It sets admin to need approval too. I’m editing the code and will post an update.
I am going to try and get the code removed from the forum – apologies I was trying to help!
Hi,
I’ve managed to add some code that will set a member account back to pending and notify admin when a user updates their profile.
If anyone can improve upon the code or find a better way, please share it with us.
// Set profile to pending after edits add_action('um_user_edit_profile', 'um_post_edit_pending_hook', 10, 2); function um_post_edit_pending_hook($user_id, $args){ global $ultimatemember; $ultimatemember->user->pending(); }
// Email admin when user updates profile add_action( 'um_user_edit_profile','notify_admin_on_update'); function notify_admin_on_update(){ global $current_user; get_currentuserinfo(); if (!current_user_can( 'administrator' )){// avoid sending emails when admin is updating user profiles $to = 'admin@enterprise-team.co.uk'; // Change for your admin email $subject = 'user updated profile'; $message = "the user : " .$current_user->business_name . " has updated his profile with:\n"; foreach($_POST as $key => $value){ $message .= $key . ": ". $value ."\n"; } wp_mail( $to, $subject, $message); } }
(Don’t forget to add your own admin email address)
I’m very grateful for the use of the Ultimate Member plug-in, but I cannot understand why these two features have not been added to the original.
To me, it doesn’t make sense to just set user accounts to pending at registration. If a user has a mind to add something unsuitable they still can once the account is approved and admin won’t know. So, it seems essential to restrict accounts for admin review after a user edits an account, as well as following registration.
I’m really sorry about this but my member users can hide their profile but I have set ‘Can make their profile private?’ to ‘No’ in user role settings.
Do you know why this is please?
By the way, I have looked in the docs and online for answers to these questions before posting here.
A couple more questions please. Should admin be able to approve profile changes please? I would like admin to approve any profile changes before they go live including images – I thought this was possible but it does not seem to be working.
Also, admin is set to approve new accounts, when admin receives an email notifying that a new account has been setup there is a link to the new user’s page.
Admin can click on that link and see the page before logging in and approving the account – should that happen please? This means that the user profile can be accessed without admin approval.
Please advise many thanks.
Hi,
So, I looked, and looked, online for a post detailing the same issue as me with no joy. I found a few Ultimate Member related posts about permalink issues but no answers, and none specifically Windows IIS related.
Therefore, I kept looking. In the end I ended up on the Microsoft site looking into rewrite rules. I noted that the rewrite code my host gave me and that I’ve been using for WordPress sites for a few years now in web.config files (in my post above) is different to the rewrite code on the Microsoft site.
So, I swapped my Microsoft original rewrite rules (above) for the Microsoft website ones below and bingo.
<rewrite> <rules> <rule name="Main Rule" stopProcessing="true"> <match url=".*" /> <conditions logicalGrouping="MatchAll"> <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> </conditions> <action type="Rewrite" url="index.php" /> </rule> </rules> </rewrite>
The site redirects users to the profile page when they login now and the permalinks seem to work.
All seems well
Hi,
Thanks for your time.
I have figured out what is causing this, but repairing it just causes another problem.
My site is on a Window server; so, to make permalinks work in WordPress I had to add the rewrite the script I add to all my sites ti the web.config. See here:
<rewrite> <rules> <rule name="WordPress Rule" stopProcessing="true"> <match url=".*" /> <conditions> <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> </conditions> <action type="Rewrite" url="index.php?page_id={R:0}" /> </rule> </rules> </rewrite>
It occurred to me that this might be the issue, So, I removed the script above from the web.config file and Ultimate Members worked fine again, when a user logs in they are redirected to their profile page.
But, now my permalinks look messy.
How do other people who use Windows servers get around this issue please anyone.
Thanks.
That’s great.
My experience with Kadence Themes: Good knowledge & reliable support.
Next time I need a premium theme I will bare this in mind and check the Kadence range.
Season’s Greetings.
Hi Kadence Themes,
Thanks for your support.
To test your suggestion I setup a local WordPress install, then I added the Virtue theme, Virtue toolkit and the Kadence supplied child theme.
Sure enough, as you said, the contact form template displayed in the admin page attributes and the form displayed in the page preview.
So, I went back to my child theme and looked for differences between the Kadence child theme and my own.
Starting with the stylesheet commented section I began to look for differences. Theme Name, Description and Template were all slightly different; although, the only differences between my Theme Name and Template were my use of an uppercase ‘V’.
So, I changed these lines to match those in the Kadence child style sheet and ‘Bingo!’
I didn’t appreciate the importance of getting the commented out section of the child theme CSS file correct, particularly the ‘The Template line’. These lines are commented out after all.
I’m still not sure how the Kadence child theme works without including the WP Codex function to enqueue the parent and child theme stylesheets though.
Anyway, the contact form is now accessible.
Can I say that this was an excellent spot by you; I’m impressed at your eye for detail.
Thanks again.
Hi,
I must have named the child theme folder with a capital incorrectly. I didn’t use your child theme, I used my own. At the time of making the child theme I had not realised that Kadence had made a child theme available.
Unfortunately though, changing the ‘V’ to lowercase did not make any difference – still no contact template in page attributes.
After renaming the child theme I tried deactivating and activating the toolkit plug-in and also uninstalling and then installing the Virtue toolkit again – both with no change.
I’m stuck; the shortcodes and all the other plug-ins work?
Any other ideas please?
Thanks for your time on this.