ftpwp
Forum Replies Created
-
BTW, I don’t have any caching plugin.
But maybe something is linked to the fact that it’s a custom field? :-/Thanks very much for your answer! ??
1. You can use the action
template_redirect
andum_is_core_page("user")
Ok. But I need the $user_id of the record/the user, we are about to view with this template/UM profile page (this $user_id being different from the current user id). Is this code appropriate to get it?
$user_username = um_queried_user(); $user = get_user_by('login', $user_username); $user_id = $user->ID;
1. You can use the action
template_redirect
…I have a concern with this WP hook. It looks like we’ll go through this test for nearly every click from every user on any page (as it’s a test ran every time someone arrives on a new page). Is there no other more specific UM hook, at the very beginning when the code to build the UM user profile page starts (either in view or edit mode)?
3.
UM()->user()->update_profile()
– this is for updating mass fields. This is useful when your field has a role field.What do you call “role field”?
If there’s no Role field in the profile form, You can use the native
update_user_meta
in this case.Well, so far
update_user_meta
properly updates the usermeta DB but the changes are not reflected on the profile page ?? It’s a bit weird, like if there was a kind of cache effect, or something else that also needs to be updated and was not :-/ Do you see what it is?For question 1 & 3, I’ve tried everything I could, I really can not make
UM()->user()->update_profile()
work ??According to this function code, it’s also supposed to update the usermeta data, but it’s not so far and there’s not proper documentation with at least a description and an example…
https://ultimatemember.com/php-docs/classes/um.core.User.html#method_update_profileBut this function looks more complete than just a simple
update_user_meta()
(providing it works), as in some context, like the um_access_profile hook, if I just proceed a simpleupdate_user_meta()
the value is updated in the usermeta DB but not reflected on the UM user profile page. So it looks like a wider update it required, wider than justupdate_user_meta()
and probably viaUM()->user()->update_profile()
.So how do we use this
UM()->user()->update_profile()
for checkboxes?Ok, I have the answer for the question 4: for checkboxes by need to use the array as value:
array (0 => 'value')
. Then this respects the UM specific format for the user_meta record value.Still need to find the appropriate hook and answer the questions 1 to 3 ??
Ok, this 2nd method works like a charm in the specific case of user registrations.
And the answers to my questions are:– name: indeed, it should be the field meta_key + “[]” for checkboxes otherwise the value will be saved in plain text and not in the Ultimate Member specific format
– id: it looks like this parameter is useless in this specific case; we are not addressing anywhere for HTML fields
– value: yes, it’s the value in text (no TRUE|FALSE, YES|NO, 1|0, etc.), BUT… be careful to have the functions.php file in UTF8 if there are special characters in the text of the value (like French accents: “Activé”)So lines like that are working fine for checkboxes:
echo '<input type="hidden" name="profile_notif_new_mention[]" value="enable" />';
Then I’ll mark this topic as “resolved” for the specific case of user’s registration, but I still need to clarify the 1st option for another context. But for that, I’ll open a new topic, it will be more clear.
Or another option may be this one…
https://docs.ultimatemember.com/article/128-add-a-hidden-field-to-your-register-formBut then what do we put for “name”, “id” and “value” for each field?
According to the source code of the profile page in edit mode, it could be that;
echo '<input type="hidden" name="profile_notif_new_post[]" id="???" value="enable" />';
echo '<input type="hidden" name="profile_notif_new_comment[]" id="???" value="enable" />';
echo '<input type="hidden" name="profile_notif_new_mention[]" id="???" value="enable" />';
name = meta_key + []
id = ??? no idea, there’s no id parameter for the checkboxes
value = value in textCan someone confirm what we’re supposed to put for hidden fields parameters?
Thanks!
I think the solution is here…
https://www.ads-software.com/support/topic/what-is-the-php-function-to-save-fields-in-um_user/#post-10965068
…but it’s still not 100% clear to me and it’s not working so far.@wptechnology, I reply to your topic in mine as yours is closed.
You suggest…
global $ultimatemember; $user_id = um_user('ID'); um_fetch_user($user_id); $toupdate[] = array('name_of_field' => 'its_value'); UM()->user()->update_profile($toupdate); update_user_meta($user_id, 'name_of_field','its_value');
In my context, 3 checkboxes to update when the profile is created, I think it would become this (in functions.php)…
add_action('um_after_save_registration_details', 'ui_registration_enable_notifications', 10, 2); function ui_registration_enable_notifications( $user_id, $submitted ) { um_fetch_user($user_id); $toUpdate[] = array('profile_notif_new_post' => array (0 => 'enable'), 'profile_notif_new_comment' => array (0 => 'enable'), 'profile_notif_new_mention' => array (0 => 'enable')); UM()->user()->update_profile($toUpdate); update_user_meta($user_id, 'profile_notif_new_post', array (0 => 'enable')); update_user_meta($user_id, 'profile_notif_new_comment', array (0 => 'enable')); update_user_meta($user_id, 'profile_notif_new_mention', array (0 => 'enable')); }
But I have several questions:
1/ Is
global $ultimatemember;
still needed in my case?2/ What’s the differences in between the
UM()->user()->update_profile()
and theupdate_user_meta()
updates? What are they respectively updating?3/ For
$toUpdate[]
, can we group 3 fields to update in 1 array like I did?4/ I think checkbox values are set by an array like this
array (0 => 'value')
, correct?5/ For the update_user_meta() update, we need to use 3 lines of code, we can’t group the update for the 3 fields, correct?
6/ How do we update checkboxes in meta? Also by an array like
array (0 => 'value')
, same?I ask you those questions as something must be wrong. I have no error but it’s not working, the checkboxes are not ticked in the user’s profile.
Thanks!
- This reply was modified 5 years, 4 months ago by ftpwp.
No, it’s of course not.
(I was sure I would get this answer, I hesitated to warn by advance that this was not a valid answer and it looks like I should really have write it.)Using “Default value”:
1/ is not setting any value before you actually edit the profile and save it, so it’s absolutely not what I want.
I want to automatically assign the value as soon as the account/profile is created.
2/ in the context of a checkbox, it’s even completely misleading the users because when they edit their profile, they ALWAYS end up with a checkbox ticked. Even if they untick, save, edit, as unticked=empty=default value, the field always appears ticked weather it’s really ticked or not.So this is of course not the solution.
Forum: Plugins
In reply to: [RSSImport] Date first, before title?Ok, but can you give me a hint about how you can do it via CSS?
You must have something in mind.
I really don’t know how CSS can help split a string in smaller sub strings and re-order them ??- This reply was modified 5 years, 4 months ago by ftpwp.
> If you right click and inspect element on the gear
> and scroll down a bit in the side pane, you’ll see…Thanks for the advise!
> Just change the color to whatever color you want in
> Custom CSS and add !important after itIt took me a bit of time to realize you forgot the “{” in your code and that’s why it was not working for me, but it’s now fixed and it works like a charm!
Thanks for your help ??
I guess the UM needs to add this code in this page…
https://docs.ultimatemember.com/article/270-how-to-change-default-ultimate-member-blue-color-using-cssCan you please post your site address here.
Nope, it’s a private family website.
If your concern is related to the context, I’m on:
- WordPress 5.2.4
- OceanWP 1.7.1
- PHP 7.1
- Ultimate Member 2.0.56
But I’ve also changed for Twenty Nineteen and it changes nothing. Exact same behavior so it’s not related to the theme.
Hi,
> Currently, we are working on the major members directory
> update which will be available in 2.1.0 update soon.Excellent. I can’t wait to have the new member directory list view! ??
The current directory is really not convenient.But I also hope you will move quickly after to reCaptcha v3 as the v2 is really a pain in some cases. It discourages new members by asking and asking to click on multiple pages of images ??
Forum: Themes and Templates
In reply to: [OceanWP] Can we overwrite language strings via a child theme?Yes.
Forum: Plugins
In reply to: [Advanced Excerpt] p & br tags added from 2nd last articleHi,
> Sorry, by the rules of the www.ads-software.com we are not allowed to ask
> for or accept login information, it is strictly prohibited and our
> account can be suspended for that.I can understand. But then why not doing a TeamViewer?
You will not get any account.> But you can send over the URL to the website privately via the
> contact form at wpkube.com/contactI’ll do it in a mn, but you will not see the blog. It’s a private website.
Thanks.
Forum: Plugins
In reply to: [Advanced Excerpt] p & br tags added from 2nd last articleHi,
Thanks for your answer.
> Being latest or 2nd shouldn’t make any difference
> as far as the plugin is concerned.That looks obvious, I’m also surprised, but it’s how it goes.
> It’s possible that the theme has different code
> for different positions which causes an issue.Well, OceanWP does not have any visible setting to make any difference in between latest or older articles. The only setting is the Excerpt length, that’s all.
And I followed your advise…
https://www.ads-software.com/support/topic/not-working-with-oceanwp-2/#post-11633223> Can you send over the URL to the website, seeing it
> should help me a bit to understand what’s going on.It’s a family website, the blog is not public.
I can give you a test account but how can I send you a private message or email?
We can also do a TeamViewer session if you want.Thanks.