PluginProbe
MyRewards / trunk
MyRewards vtrunk
5.7.8 5.7.7 5.7.6 trunk 1.2.2 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.1.1 2.2.0 2.3.0 2.4.0 2.4.1 2.5.0 2.6.4 2.6.6 3.0.0.0 3.1.0 3.1.2 3.1.2.1 3.10.4 3.10.9 All 165 releases
woorewards / include / compatibility / ultimatemember.php

ultimatemember.php in MyRewards trunk, at include/compatibility/ultimatemember.php

42 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace LWS\WOOREWARDS\Compatibility;
3
4 // don't call the file directly
5 if( !defined( 'ABSPATH' ) ) exit();
6
7 class UltimateMember
8 {
9 public static function install()
10 {
11 $me = new self();
12 \add_filter('lws_adminpanel_field_shortcode_options', array($me, 'addDesc'), 10, 3);
13 \add_filter('lws_woorewards_shortcode_current_user_id', array($me, 'getCurrentUserId'), 10, 3);
14 }
15
16 public function getCurrentUserId($userId=false, $atts=array(), $shortcode='')
17 {
18 if ($atts && \is_array($atts)) {
19 if (isset($atts['um-public']) && \LWS\Adminpanel\Tools\Conveniences::argIsTrue($atts['um-public'])) {
20 if (\function_exists('um_get_requested_user'))
21 return \um_get_requested_user();
22 else
23 return false;
24 }
25 if (isset($atts['user_id']))
26 return $atts['user_id'];
27 }
28 return $userId;
29 }
30
31 // Add shortcode options description if Ultimate Member is active
32 public function addDesc($options, $shortcode, $flags)
33 {
34 if (\in_array('current_user_id', $flags)) {
35 $options['um-public'] = array(
36 'option' => 'um-public',
37 'desc' => __("Set the option to true (um-public='true') to make the information public on Ultimate Members profile pages", 'woorewards-lite'),
38 );
39 }
40 return $options;
41 }
42 }