-
Author
-
July 22, 2017 at 22:42 #168319
dynamus
ParticipantHi,
I would like to offer when a client logs on the intranet our native mobile app if BuddyApp detects that the client is mobile.
fyi: Our network is 100% private.
How could I do that ? ( I program a little)
Samples are best for me. If the sample could be a beautiful one, better.
Many thanks,
Jr.
July 22, 2017 at 23:04 #168321Kieran_SQ
ModeratorHi @dynamus,
There would be several ways to do this, the simplest would be to use is_user_logged_in() with wp_is_mobile(). This will check first if the user is logged in and secondly if they’re on a mobile device. See here https://developer.wordpress.org/reference/functions/is_user_logged_in/ and here https://codex.wordpress.org/Function_Reference/wp_is_mobile for examples about these two functions.
Depending on what you wanted to do you could either force a redirect or simply show content specific to those two conditions using theme hooks, see here for information about theme hooks https://archived.seventhqueen.com/documentation/buddyapp#hooks.
An example of using the theme hooks would be something like
COPY CODE// Check if user is logged in and on mobile if they are add content before content add_action('kleo_before_content','check_mobile_logged_in'); function check_mobile_logged_in() { if ( is_user_logged_in() && wp_is_mobile() ) { echo do_shortcode('[SHORTCODE HERE]'); } }Or
COPY CODE// Check if user is logged in and on mobile if they are add content before content add_action('kleo_before_content','check_mobile_logged_in'); function check_mobile_logged_in() { if ( is_user_logged_in() && wp_is_mobile() ) { echo 'My text or HTML here'; } }Hope this helps,
Kieran.
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Ticket solution -
AuthorPosts
The forum ‘General questions’ is closed to new topics and replies.