Skip to main content
30 events
when toggle format what by license comment
Dec 2, 2020 at 6:37 comment added freedom667 hi there again. I have a new problem again. it is "delete an array element when its date expires" wordpress.stackexchange.com/questions/379130/… can you help me?
Nov 27, 2020 at 14:29 comment added freedom667 anyway, thanks for your help and interested for a week. I accepted your answer. I appreciate you :)
Nov 27, 2020 at 10:44 comment added Tom J Nowell You'll have to ask a new question for that, but I'd also spend some time rewording it as that new question is very difficult to parse in english
Nov 27, 2020 at 7:54 vote accept freedom667
Nov 27, 2020 at 7:54 comment added freedom667 the brackets are my mistake I fixed it. Also I put your codes and it works except get_user_meta. but now I have a new problem. the problem is start_time. because when I give end_time, it always updating because of date(). So I have to give a start date when press "update user info" button. How can I do this?
Nov 26, 2020 at 6:39 history edited freedom667 CC BY-SA 4.0
deleted 8 characters in body
Nov 25, 2020 at 12:47 comment added Tom J Nowell Also, those user levels, what do the values look like? Are they just numbers?
Nov 25, 2020 at 12:45 history edited Tom J Nowell CC BY-SA 4.0
deleted 9 characters in body
Nov 25, 2020 at 12:42 comment added Tom J Nowell Fix the indenting in the crf_update_profile_fields function and it'll become obvious that there are 2 opening { brackets but 3 closing brackets }, the code in your question should generate a PHP fatal error, and it would not add any fields to the user profile page. It is clearly incomplete and broken. I've fixed the indenting on that function so the bug should now be super obvious. I understand that you have unrelated code you are trying to hide, but doing so is not helpful, it's unproductive
Nov 25, 2020 at 12:39 comment added Tom J Nowell The code adds HTML to an array named $elements but then it does nothing with that array, there is no echo statement, I don't see where it gets printed to the browser. Clearly there is something important missing. All the examples for show_user_profile have opening and closing PHP tags and output directly, I don't understand why there is an $elements array or how it gets printed, in that function it isn't printed, so there must be missing code. crf_update_profile_fields still has a PHP syntax error too, it has been modified to remove something
Nov 25, 2020 at 10:50 history edited freedom667 CC BY-SA 4.0
added 4 characters in body
Nov 25, 2020 at 10:47 comment added freedom667 I added dates for level expiration but I have to write startdate too. the cronjob executing by a wordpress cron plugin. I did not understand what is the problem in update_fields?
Nov 25, 2020 at 9:31 comment added Tom J Nowell Is crf_show_extra_profile_fields complete? I seethings being added to the $elements array but then nothing happens, it never gets used and nothing is output I also see a cron job callback, but no cron scheduling code. crf_update_profile_fields also has extra closing brackets that would cause a PHP fatal error
Nov 25, 2020 at 7:22 comment added freedom667 I wrote all functions
Nov 25, 2020 at 7:22 history edited freedom667 CC BY-SA 4.0
added 1471 characters in body
Nov 24, 2020 at 11:57 comment added Tom J Nowell can you edit your question to include that in the appropriate place, then include the level control code as well? I want to be able to reproduce this locally, I'm hoping I can replace the rua_get_user call with a hardcoded array and run tests
Nov 24, 2020 at 6:31 comment added freedom667 and and saving hook is add_action( 'personal_options_update', 'crf_update_profile_fields' ); add_action( 'edit_user_profile_update', 'crf_update_profile_fields' ); function crf_update_profile_fields( $user_id ) {} and I have control function of it, So If present date greater than date of a level, the level will be remove but level's array removing all level.
Nov 24, 2020 at 6:30 comment added freedom667 in functions.php the hook is add_action( 'show_user_profile', 'crf_show_extra_profile_fields' ); add_action( 'edit_user_profile', 'crf_show_extra_profile_fields' ); function crf_show_extra_profile_fields( $user ) {}
Nov 23, 2020 at 12:18 comment added Tom J Nowell Where is this code located? What comes before and after it? Is this in a user edit screen in the Admin UI?
Nov 19, 2020 at 9:45 history edited Tom J Nowell CC BY-SA 4.0
deleted 2 characters in body
Nov 19, 2020 at 7:56 history edited freedom667 CC BY-SA 4.0
deleted 2 characters in body
Nov 18, 2020 at 20:45 answer added Tom J Nowell timeline score: 0
Nov 18, 2020 at 20:32 comment added freedom667 sorry about that. my english is not advanced. just tell me How can I store multiple meta with same input name. there is a varible name $menu and this is a select menu, it gives access time. $menu varible is in foreach loop because of user levels. I have to give different access time for each levels. update_user_meta saving just last element of $elements array. $elements array gets user levels. there are 6 user levels
Nov 18, 2020 at 13:44 comment added Tom J Nowell Also, the english in your question is very difficult to understand, are you asking how to change this to a checkbox list? What is the $elements array? It's unclear what your code is supposed to do. Please edit your question to make it easier to understand
Nov 18, 2020 at 13:38 comment added Tom J Nowell I know, as I said it was a comment, not an answer. Note that get_user_meta can do things that get_the_author_meta cannot. Technically get_the_author_meta shouldn't work here as the field parameter should not be able t accept arbitrary meta key values as there's a predefined whitelist, which means any answer will likely require get_user_meta, if not for that reason but because of its 3rd parameter. It is not possible to store the same meta key multiple times then retrieve them with get_the_author_meta, but it is with get_user_meta.
Nov 18, 2020 at 13:31 comment added freedom667 my problem is, how can I store the meta as multiple
Nov 18, 2020 at 10:27 comment added Tom J Nowell No, if it did I would have left an answer rather than a comment, you should still use get_user_meta instead, get_the_author_meta is innapropriate for this use case
Nov 17, 2020 at 20:33 comment added freedom667 I did not understand. get_user_meta will solve it directly?
Nov 17, 2020 at 15:59 comment added Tom J Nowell A side-note, you should use get_user_meta rather than get_the_author_meta
Nov 17, 2020 at 15:24 history asked freedom667 CC BY-SA 4.0