| Server IP : 68.178.247.200 / Your IP : 216.73.217.50 Web Server : Apache System : Linux p3plzcpnl489463.prod.phx3.secureserver.net 4.18.0-553.54.1.lve.el8.x86_64 #1 SMP Wed Jun 4 13:01:13 UTC 2025 x86_64 User : x9dppmxs4rgd ( 8559391) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/x9dppmxs4rgd/public_html/wp-content/themes/grace-church/fw/core/ |
Upload File : |
<?php
/**
* Grace-Church Framework: Registered Users
*
* @package grace_church
* @since grace_church 1.0
*/
// Disable direct call
if ( ! defined( 'ABSPATH' ) ) { exit; }
// Theme init
if (!function_exists('grace_church_users_theme_setup')) {
add_action( 'grace_church_action_before_init_theme', 'grace_church_users_theme_setup' );
function grace_church_users_theme_setup() {
if ( is_admin() ) {
// Add extra fields in the user profile
add_action( 'show_user_profile', 'grace_church_add_fields_in_user_profile' );
add_action( 'edit_user_profile', 'grace_church_add_fields_in_user_profile' );
// Save / update additional fields from profile
add_action( 'personal_options_update', 'grace_church_save_fields_in_user_profile' );
add_action( 'edit_user_profile_update', 'grace_church_save_fields_in_user_profile' );
}
}
}
// Return (and show) user profiles links
if (!function_exists('grace_church_show_user_socials')) {
function grace_church_show_user_socials($args) {
$args = array_merge(array(
'author_id' => 0, // author's ID
'allowed' => array(), // list of allowed social
'size' => 'small', // icons size: tiny|small|big
'style' => grace_church_get_theme_setting('socials_type')=='images' ? 'bg' : 'icons', // style for show icons: icons|images|bg
'echo' => true // if true - show on page, else - only return as string
), is_array($args) ? $args
: array('author_id' => $args)); // If send one number parameter - use it as author's ID
$output = '';
$upload_info = wp_upload_dir();
$upload_url = $upload_info['baseurl'];
$social_list = grace_church_get_theme_option('social_icons');
$list = array();
if (is_array($social_list) && count($social_list) > 0) {
foreach ($social_list as $soc) {
if ($args['style'] == 'icons') {
$parts = explode('-', $soc['icon'], 2);
$sn = isset($parts[1]) ? $parts[1] : $sn;
} else {
$sn = basename($soc['icon']);
$sn = grace_church_substr($sn, 0, grace_church_strrpos($sn, '.'));
if (($pos=grace_church_strrpos($sn, '_'))!==false)
$sn = grace_church_substr($sn, 0, $pos);
}
if (count($args['allowed'])==0 || in_array($sn, $args['allowed'])) {
$link = get_the_author_meta('user_' . ($sn), $args['author_id']);
if ($link) {
$icon = $args['style']=='icons' || grace_church_strpos($soc['icon'], $upload_url)!==false ? $soc['icon'] : grace_church_get_socials_url(basename($soc['icon']));
$list[] = array(
'icon' => $icon,
'url' => $link
);
}
}
}
}
if (count($list) > 0) {
$output = '<div class="sc_socials sc_socials_size_small">' . trim(grace_church_prepare_socials($list, array( 'style' => $args['style'], 'size' => $args['size']))) . '</div>';
if ($args['echo']) echo ($output);
}
return $output;
}
}
// Show additional fields in the user profile
if (!function_exists('grace_church_add_fields_in_user_profile')) {
function grace_church_add_fields_in_user_profile( $user ) {
?>
<h3><?php esc_html_e('User Position', 'grace-church'); ?></h3>
<table class="form-table">
<tr>
<th><label for="user_position"><?php esc_html_e('User position', 'grace-church'); ?>:</label></th>
<td><input type="text" name="user_position" id="user_position" size="55" value="<?php echo esc_attr(get_the_author_meta('user_position', $user->ID)); ?>" />
<span class="description"><?php esc_html_e('Please, enter your position in the company', 'grace-church'); ?></span>
</td>
</tr>
</table>
<h3><?php esc_html_e('Social links', 'grace-church'); ?></h3>
<table class="form-table">
<?php
$socials_type = grace_church_get_theme_setting('socials_type');
$social_list = grace_church_get_theme_option('social_icons');
if (is_array($social_list) && count($social_list) > 0) {
foreach ($social_list as $soc) {
if ($socials_type == 'icons') {
$parts = explode('-', $soc['icon'], 2);
$sn = isset($parts[1]) ? $parts[1] : $sn;
} else {
$sn = basename($soc['icon']);
$sn = grace_church_substr($sn, 0, grace_church_strrpos($sn, '.'));
if (($pos=grace_church_strrpos($sn, '_'))!==false)
$sn = grace_church_substr($sn, 0, $pos);
}
if (!empty($sn)) {
?>
<tr>
<th><label for="user_<?php echo esc_attr($sn); ?>"><?php echo trim(grace_church_strtoproper($sn)); ?>:</label></th>
<td><input type="text" name="user_<?php echo esc_attr($sn); ?>" id="user_<?php echo esc_attr($sn); ?>" size="55" value="<?php echo esc_attr(get_the_author_meta('user_'.($sn), $user->ID)); ?>" />
<span class="description"><?php echo sprintf( esc_html__('Please, enter your %s link', 'grace-church'), grace_church_strtoproper($sn)); ?></span>
</td>
</tr>
<?php
}
}
}
?>
</table>
<?php
}
}
// Save / update additional fields
if (!function_exists('grace_church_save_fields_in_user_profile')) {
function grace_church_save_fields_in_user_profile( $user_id ) {
if ( !current_user_can( 'edit_user', $user_id ) )
return false;
update_user_meta( $user_id, 'user_position', $_POST['user_position'] );
$socials_type = grace_church_get_theme_setting('socials_type');
$social_list = grace_church_get_theme_option('social_icons');
if (is_array($social_list) && count($social_list) > 0) {
foreach ($social_list as $soc) {
if ($socials_type == 'icons') {
$parts = explode('-', $soc['icon'], 2);
$sn = isset($parts[1]) ? $parts[1] : $sn;
} else {
$sn = basename($soc['icon']);
$sn = grace_church_substr($sn, 0, grace_church_strrpos($sn, '.'));
if (($pos=grace_church_strrpos($sn, '_'))!==false)
$sn = grace_church_substr($sn, 0, $pos);
}
update_user_meta( $user_id, 'user_'.($sn), $_POST['user_'.($sn)] );
}
}
}
}
?>