本文整理汇总了PHP中c_ws_plugin__s2member_utils_users::get_user_field方法的典型用法代码示例。如果您正苦于以下问题:PHP c_ws_plugin__s2member_utils_users::get_user_field方法的具体用法?PHP c_ws_plugin__s2member_utils_users::get_user_field怎么用?PHP c_ws_plugin__s2member_utils_users::get_user_field使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类c_ws_plugin__s2member_utils_users
的用法示例。
在下文中一共展示了c_ws_plugin__s2member_utils_users::get_user_field方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sc_get_details
/**
* Handles the Shortcode for: `[s2Get /]`.
*
* @package s2Member\s2Get
* @since 3.5
*
* @attaches-to ``add_shortcode("s2Get");``
*
* @param array $attr An array of Attributes.
* @param string $content Content inside the Shortcode.
* @param string $shortcode The actual Shortcode name itself.
* @return mixed Value of the requested data, or null on failure.
*
* @todo Prevent this routine from potentially returning objects/arrays?
*/
public static function sc_get_details($attr = FALSE, $content = FALSE, $shortcode = FALSE)
{
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action("ws_plugin__s2member_before_sc_get_details", get_defined_vars());
unset($__refs, $__v);
$attr = c_ws_plugin__s2member_utils_strings::trim_qts_deep((array) $attr);
// Force array; trim quote entities.
$attr = shortcode_atts(array("constant" => "", "user_field" => "", "user_option" => "", "user_id" => ""), $attr);
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action("ws_plugin__s2member_before_sc_get_details_after_shortcode_atts", get_defined_vars());
unset($__refs, $__v);
if ($attr["constant"] && defined($attr["constant"])) {
if (!is_multisite() || !c_ws_plugin__s2member_utils_conds::is_multisite_farm() || is_main_site() || preg_match("/^S2MEMBER_/i", $attr["constant"])) {
$get = constant($attr["constant"]);
}
} else {
if ($attr["user_field"] && (is_user_logged_in() || $attr["user_id"])) {
$get = c_ws_plugin__s2member_utils_users::get_user_field($attr["user_field"], (int) $attr["user_id"]);
} else {
if ($attr["user_option"] && (is_user_logged_in() || $attr["user_id"])) {
$get = get_user_option($attr["user_option"], (int) $attr["user_id"]);
}
}
}
return apply_filters("ws_plugin__s2member_sc_get_details", isset($get) ? $get : null, get_defined_vars());
}
示例2: sc_get_details
/**
* Handles the Shortcode for: `[s2Get /]`.
*
* @package s2Member\s2Get
* @since 3.5
*
* @attaches-to ``add_shortcode('s2Get');``
*
* @param array $attr An array of Attributes.
* @param string $content Content inside the Shortcode.
* @param string $shortcode The actual Shortcode name itself.
*
* @return mixed Value of the requested data, or null on failure.
*/
public static function sc_get_details($attr = array(), $content = '', $shortcode = '')
{
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action('ws_plugin__s2member_before_sc_get_details', get_defined_vars());
unset($__refs, $__v);
// Allow variables to be modified by reference.
$attr = c_ws_plugin__s2member_utils_strings::trim_qts_deep((array) $attr);
// Force array; trim quote entities.
$attr = shortcode_atts(array('constant' => '', 'user_field' => '', 'user_option' => '', 'user_id' => ''), $attr);
foreach (array_keys(get_defined_vars()) as $__v) {
$__refs[$__v] =& ${$__v};
}
do_action('ws_plugin__s2member_before_sc_get_details_after_shortcode_atts', get_defined_vars());
unset($__refs, $__v);
// Allow variables to be modified by reference.
if ($attr['constant'] && defined($attr['constant'])) {
if (!is_multisite() || !c_ws_plugin__s2member_utils_conds::is_multisite_farm() || is_main_site() || preg_match('/^S2MEMBER_/i', $attr['constant'])) {
$get = constant($attr['constant']);
}
} else {
if ($attr['user_field'] && (is_user_logged_in() || $attr['user_id'])) {
$get = c_ws_plugin__s2member_utils_users::get_user_field($attr['user_field'], (int) $attr['user_id']);
} else {
if ($attr['user_option'] && (is_user_logged_in() || $attr['user_id'])) {
$get = get_user_option($attr['user_option'], (int) $attr['user_id']);
}
}
}
if (isset($get) && (is_array($get) || is_object($get))) {
$_get_array = $get;
// Temporary variable.
$get = array();
// New empty array.
foreach ($_get_array as $_key_prop => $_value) {
if (is_scalar($_value)) {
// One dimension only.
$get[$_key_prop] = (string) $_value;
}
}
unset($_get_array, $_key_prop, $_value);
// Housekeeping.
$get = implode(', ', $get);
// Convert to a string now.
}
if (isset($get) && !is_scalar($get)) {
$get = '';
} else {
if (isset($get)) {
$get = (string) $get;
}
}
// Convert to a string.
return apply_filters('ws_plugin__s2member_sc_get_details', isset($get) ? $get : '', get_defined_vars());
}
示例3: get_user_field
function get_user_field($field_id = FALSE, $user_id = FALSE)
{
return c_ws_plugin__s2member_utils_users::get_user_field($field_id, $user_id);
}