Shortcode for displaying the user’s first name?
Shortcode for displaying the user’s first name?
Shortcode for displaying the user’s first name?
yes you can simply do all these with this plugin: http://wordpress.org/plugins/easy-digital-downloads/
It turns out, my code above is indeed all that is needed. Apparently the mistake I made was that I didn’t load the translated version of the page in the frontend at least once, so icl_t() didn’t auto-register the strings. Also keep in mind, if you’re looking at correct string count in String Translation context … Read more
I fixed it doing like below: $meta_value = //data from an API (e.g.: 19, 34, 1290 etc) $meta_value_string = “”. $meta_value; $user_id = wp_insert_user( $new_user_data ); update_user_meta( $user_id, ‘my_meta_key’, $meta_value_string ); Now it works fine.
You should use get_author_posts_url() to get the author’s link.
Instead of ‘request’ function, use this : add_action(‘pre_user_query’, ‘user_column_orderby’); function user_column_orderby($userquery){ if(‘Votes’==$userquery->query_vars[‘orderby’]) { global $wpdb; $userquery->query_from .= ” LEFT OUTER JOIN $wpdb->usermeta AS alias ON ($wpdb- >users.ID = alias.user_id) “; $userquery->query_where .= ” AND alias.meta_key = ‘wp__user_like_count’ “; $userquery->query_orderby = ” ORDER BY alias.meta_value “.($userquery->query_vars[“order”] == “ASC” ? “asc ” : “desc “); } }
wp_ajax_nopriv_{$action} can trigger a non-logged in ajax request. add_action( ‘wp_ajax_nopriv_add_foobar’, ‘prefix_ajax_add_foobar’ ); function prefix_ajax_add_foobar() { // Handle request then generate response using WP_Ajax_Response } get_user_by can pull the user’s data via email $user = get_user_by(’email’, ‘[email protected]’) update_user_meta can update the user’s metadata. update_user_meta( $user->ID, $meta_key, $meta_value, $prev_value );
Remove apply_filters() and just pass the array values into your wp_insert_user: array( ‘first_name’ => $nombre, ‘last_name’ => $apellidos, ‘user_pass’ => $contrasena, ‘user_login’ => $username, ‘user_email’ => $email, ‘role’ => ‘subscriber’, ) WordPress already managed those apply_filters, so there’s no reason to use them in your code. Hope it helps! Me dices si te sirvió, también … Read more
You didn’t mention whether users could only reach this page when logged in, so this example includes a check to make sure the current visitor is logged in, otherwise it won’t output anything. <?php // create the shortcode add_shortcode(‘wpse_312268_show_cc_info’, ‘create_wpse_312268_shortcode’); function create_wpse_312268_shortcode() { // only do something if user is logged in if(is_user_logged_in()) { // … Read more
You have to use meta query. $query = new WP_Query( array( ‘meta_key’ => ‘coauthor’ ) ); Later, you can loop through this query.