I was lookign for a way to display the data that belongs to the current user.
i came across this article
https://wpdatatables.com/documentation/front-end-editing/allowing-users-to-edit-only-their-own-data/
but then I realized that if i enable this, ‘enable server-side processing’ is automatically turned on, which I do not wish to. Plus I do not want give edit access to the user.
and i saw another method using %CURRENT_USER_ID%
but when i add the line where user_id = %CURRENT_USER_ID% then I get an error saying ‘No data fetched!, If you are trying to save table …”
https://wpdatatables.com/documentation/table-features/using-placeholders/
FYI, I am using SQL query for the data source type.
so what is the best way to filter data belongs to the current logged in user?
Please advise
Thank you
]]>I couldn’t find any configuration that would support something that could be added to an FSE template for a CPT where I can control visibility based on whether the current post is owned by the current user (and also not show it if the user is logged out, but that part is easy).
The closest thing I could find was the Location / Author Attributes rules, but that seems to be something that would be set per page.
Is there anything that would allow a dynamic match value based on logged in user?
I’m not afraid to code a workaround … just looking for your advice. Thanks!
]]>Sorry my question might be silly but I can’t figure out how to display a pod which is user-dependant within Gutenberg Editor.
I use the Pods Field Value block on a regular WP page. When picking this block I have this Pods Option field on the right-side of my page in Gutenberg labelled “Username or ID”.
This field works well when I add a specific value: 1, 458, 9875 … corresponding to a specific user account. I then have the value I want displaying on the front-end.
But obviously what I want is something dynamic in there like {@user.id} or {@currentuser.id} that will show the pod value related to the current logged in user.
How do I do this? I guess it’s pretty simple but I can’t figure this out.
Thanks a lot.
]]>I have a specific need, I don’t understand how to ?
I’d like to display single content and lists of custom post, by I need to filter this content by value passed in custom field..
To explain, I need to manages Tennis Clubs in my Back Office, but I would like to filter by my ‘adminsitrators’ acf == current_user to display on front page.
I’m lost can you help my on this one.
Thanks by advance..
Regards from France
]]>I am looking to direct logged users and non-logged users to different forms on my website.
Can this plugin obtain the logged users details using ‘wp_get_current_user()’ and add to a URL? For example, yourawsomesite.com/link-to-the-form/?name=John Doe&[email protected]?
If so, does this plugin offer conditional URL forwarding based on the value of ‘wp_get_current_user()’?
Thanks.
]]>I’m currently using UsersWP and GeoDirectory and I want to achieve the following:
if ( is_user_logged_in() ) {
echo 'Welcome, registered user!';
global $current_user;
get_currentuserinfo();
switch (true) {
case ( user_can( $current_user, "barber") ):
//blank
break;
//if user role is barber shop:
case ( user_can( $current_user, "barber_shop") ):
//create a new meny item
add_filter('uwp_account_available_tabs', 'uwp_account_available_tabs_cb', 10, 1);
function uwp_account_available_tabs_cb($tabs){
$tabs['barber-shop-tab'] = array(
'title' => __( 'Edit My Barber Shop', 'userswp' ),
'icon' => 'fas fa-store-alt',
);
return $tabs;
}
//create a header title for the new menu item
add_filter('uwp_account_page_title', 'uwp_account_page_title_cb', 10, 2);
function uwp_account_page_title_cb($title, $type){
if ( $type == 'barber-shop-tab' ) {
$title = __( 'Edit My Barber Shop', 'uwp-messaging' );
}
return $title;
}
//create content of the new menu item
add_filter('uwp_account_form_display', 'uwp_account_form_display_cb', 10, 1);
function uwp_account_form_display_cb($type){
if ( $type == 'barber-shop-tab' ) {
//check if user already has created a location:
//if yes provide an Edit Location button
//if not provide a Create New Location button
echo do_shortcode('[gd_add_listing mapzoom="0" label_type="horizontal" show_login="1" mb="3"]');
}
}
break;
case ( user_can( $current_user, "administrator") ):
//blank
break;
}
} else {
echo 'Welcome, visitor!';
}
I have noticed that when using echo do_shortcode(‘[gd_add_listing mapzoom=”0″ label_type=”horizontal” show_login=”1″ mb=”3″]’); inside of UsersWP > Account, it brakes the MAP and it’s not loading. To avoid this I want to simply create two buttons inside UsersWP > Account > Edit My Barber Shop.
Thanks for your time, if you have any suggestions please let me know how to achieve this.
]]>I’m having issues pulling that data from the current user with wp_get_current_user(); function, I’ve tried different things but I’m not a developer and it’s quite hard.
How could I get the store name from the current logged in user?
]]>wp_get_current_user()
cannot be used to obtain user credentials.
// validate contact form 7
add_filter('wpcf7_validate_email*', 'custom_email_confirmation_validation_filter', 20, 2);
function custom_email_confirmation_validation_filter($result, $tag)
{
$current_user_c = wp_get_current_user();
var_dump($current_user_c);
if ('apply-email' == $tag->name) {
$apply_email = isset($_POST['apply-email']) ? trim($_POST['apply-email']) : '';
$user_email = $current_user_c->user_email;
if ($apply_email != $user_email) {
$result->invalidate($tag, "間違ったメールアカウト");
}
}
return $result;
}
]]>