pandglobal
Forum Replies Created
-
Forum: Developing with WordPress
In reply to: Listing all users through shortcodeBcs am working with a custom table i created, since thats the case, is it possible to add new columns inside the user meta table and then this print out the values using get_user meta functions?
Forum: Developing with WordPress
In reply to: Listing all users through shortcodeThanks @sterndata but my reason for going directly to the database is bcs there are tables too that i wish to include which are not usermeta keys, so i think targetting the data base will be helpfull to me, my only problem is how to return a full list based in user ID
Forum: Fixing WordPress
In reply to: How to delete unused user metakey@sterndata thanks for your contribution, and i have equally given you list of metakeys to search for so i can know how to do it via phpmyadmin.
Thank you
Forum: Fixing WordPress
In reply to: How to delete unused user metakeyThe meta keys are
billing_country
billing_state
billing_city
AUTHCODE1
AUTHCODE2The above are the metakeys, and i want to delete them entirely my my usermeta.
Forum: Developing with WordPress
In reply to: Restrict a user meta value to be unique across all usersthanks @bcworkz but i dont wish to use the $wpdb function as it makes me add my wordpress datatbase prefix in the function php, i am using the get users()
and am able to get those user_email address printed out in a list or
as you suggested, so printing it out for users to see is not the plan, because i dont intend to place it on the page body, i just wanted to retrieve those values and validate them. but then if i put out it shows list of users email adress in a list or preformat method, but if i add it on the validation code, only one email address from the list of email addresses on the site is printed out. ` $blogusers = get_users('meta_key=first_name'); foreach ($blogusers as $user) { echo '<pre>' .$user->user_email . '</pre>';` the above code will list email addresses: [email protected] [email protected] [email protected] [email protected] but during validation only [email protected] is validated, others are not.
Forum: Developing with WordPress
In reply to: Restrict a user meta value to be unique across all usersMy plan is to do this
First step: use a code to print out all the users phone number located in the user metakey phone_number and i want to print them in an array.
Step two. Then i will wrap my validation code using the in_array()
Just that i don’t know the function that can print out all users phone number in an array format adding new line per each phone number.
Forum: Developing with WordPress
In reply to: Restrict a user meta value to be unique across all usersYour suggestions seems perfect, but can i have a sample wp_query function that i can use to target the metakey phone_number
And i will prefer to print out the results in an array format and in orderly list, and only the user meta key of phone_number should be printed outForum: Developing with WordPress
In reply to: Restrict a user meta value to be unique across all usersi have tried this yet is not working
add_filter( 'gform_field_validation_19_1', 'custom_validationusd500', 10, 4 ); function custom_validationusd500( $result, $value, $form, $field ) { $args = array( 'fields' => 'all', ); $blogusers = get_users( $args); foreach($blogusers as $key => $user){ $usero = $user->user_login; if ( $value != $usero ) { $result['is_valid'] = false; $result['message'] = 'The usd value must be $10 or above.'; } return $result; }
- This reply was modified 5 years, 2 months ago by Jan Dembowski.
- This reply was modified 5 years, 2 months ago by bcworkz.
Forum: Developing with WordPress
In reply to: Validating drop down fieldThanks @joyously i was able to get something from the post link you sent to me and i ended up with the above code, it works perfectly for me.
If you dont mind you can look at my second question in the link https://www.ads-software.com/support/topic/restrict-a-user-meta-value-to-be-unique-across-all-users/ and see if you can be of any help too.
Thanks in a million
Forum: Developing with WordPress
In reply to: Validating drop down field`add_filter( ‘gform_field_validation_19_2’, ‘custom_validationusd22’, 10, 4 );
function custom_validationusd22( $result, $value, $form, $field ) {$choices = array(
array( ‘value’ => ‘MALAYSIA’, ‘text’ => ‘NIGERIA’),
array( ‘value’ => ‘CHINA’, ‘text’ => ‘CHINA’),
array( ‘value’ => ‘UNITED STATES’, ‘text’ => ‘UNITED STATES’),
array( ‘value’ => ‘LONbDON’, ‘text’ => ‘LONDONdd’),
array( ‘value’ => ‘SPAIN’, ‘text’ => ‘SPAIN’),
array( ‘value’ => ‘ITAoLY’, ‘text’ => ‘ITALY’),
array( ‘value’ => ‘TURKEY’, ‘text’ => ‘TURKEY’),
array( ‘value’ => ‘ROMANIA’, ‘text’ => ‘ROMANIA’),
);$baad = array_column($choices, ‘value’);
if ( ! in_array( $value, $baad ) ) {
$result[‘is_valid’] = false;
$result[‘message’] = ‘Sorry, your selection was not part of the options in the array!.’;
}
return $result;
}Please i need update, have the function for gravity payment be added?
Forum: Developing with WordPress
In reply to: Validating drop down fieldThanks alot @joyously you rightly said the thing, if my arrays where the way you stated above then i won’t be having issues as it validates as $choices.
But my bigger problem is that am using multiple array not a single array like array(‘China’, ‘London’, ‘Spain’, )If only i can get array(array()) into one single variable called $choice then my problems are over.
I don’t know if using foreach() would helpForum: Developing with WordPress
In reply to: Validating drop down fieldThanks steve but this is not a plugin error or fix, is a simple array function help that i need, it can be as an ordinary html drop down field that i needs a server side validation of. So every persons creating a form that has drop down should know how to validate is values at the server ends, incase a user tries to manipulate the choices from the front end or client side.
Please help out steve, i know you are a guru.
Anyone developing with wordpress should consider validations seriouslyForum: Fixing WordPress
In reply to: Locating all users metakey in databaseSomething like this should work?
UPDATE wp_users SET display_name=’0′;
Forum: Fixing WordPress
In reply to: Locating all users metakey in databaseActually thanks for the code, but i wasn’t targeting that very metakey, am only using it for illustrations, i have a custom metakey called date_ofbirth thats the one i will target.
Please can i use set value option to make set the values to 0 instead of clearing it entirely.
If so which SQL command can i use for set value?