Permalink
Browse files

Extend wfx_edit_meta() - new users parameter

New parameter for wfx_edit_meta() - ‘usercontrols’ - shows admin link to edit users (default is ’N’ - accepted values ‘Y’/’N’)
  • Loading branch information...
Jonnyauk committed Sep 8, 2017
1 parent 8e74634 commit 823719919907e4d9b89405d3dcd63af2f3b07378
Showing with 11 additions and 6 deletions.
  1. +3 −3 functions.php
  2. +8 −3 wf-includes/wf-display-functions.php
View
@@ -1149,13 +1149,14 @@
* is used instead of get_currentuserinfo() (function deprecated)
*
* @since 0.85
* @version 2.2
* @version 2.6
*
* @param [string] $userintro Text string in first list item. [Welcome]
* @param [string] $username Display username after intro (within same list item). Y/N [Y]
* @param [string] $intro Display intro. Y/N [Y]
* @param [string] $postcontrols Show post controls. Y/N [Y]
* @param [string] $pagecontrols Show page controls. Y/N [Y]
* @param [string] $usercontrols Show user controls. Y/N [N]
* @param [string] $adminlink Show admin area link. Y/N [Y]
* @param [string] $widgetslink Show edit widgets link. Y/N [N]
* @param [string] $logoutlink Show WordPress logout link. Y/N [N]
@@ -1164,9 +1165,8 @@
* @param [string] $div Wrap output in containing <div>. Y/N [N]
* @param [string] $divclass Containing <div> class if used. [wf-edit-meta-box]
*
* @todo Review code, make smarter and deploy into Wonderflux widget.
* @todo Extend further to accomodate when a user is NOT logged in (like WordPress Meta widget stylee!)
* @todo Extend for user profiles, editing taxonomies etc.
* @todo Extend for editing taxonomies etc.
*/
if ( !function_exists( 'wfx_edit_meta' ) ) : function wfx_edit_meta($args) { global $wfx; $wfx->edit_meta($args); } endif;
@@ -1684,13 +1684,14 @@ function wf_excerpt($args) {
* is used instead of get_currentuserinfo() (function deprecated)
*
* @since 0.85
* @version 2.2
* @version 2.6
*
* @param [string] $userintro Text string in first list item. [Welcome]
* @param [string] $username Display username after intro (within same list item). Y/N [Y]
* @param [string] $intro Display intro. Y/N [Y]
* @param [string] $postcontrols Show post controls. Y/N [Y]
* @param [string] $pagecontrols Show page controls. Y/N [Y]
* @param [string] $usercontrols Show user controls. Y/N [N]
* @param [string] $adminlink Show admin area link. Y/N [Y]
* @param [string] $widgetslink Show edit widgets link. Y/N [N]
* @param [string] $logoutlink Show WordPress logout link. Y/N [N]
@@ -1699,9 +1700,8 @@ function wf_excerpt($args) {
* @param [string] $div Wrap output in containing <div>. Y/N [N]
* @param [string] $divclass Containing <div> class if used. [wf-edit-meta-box]
*
* @todo Review code, make smarter and deploy into Wonderflux widget.
* @todo Extend further to accomodate when a user is NOT logged in (like WordPress Meta widget stylee!)
* @todo Extend for user profiles, editing taxonomies etc.
* @todo Extend for editing taxonomies etc.
*/
function wf_edit_meta($args) {
@@ -1711,6 +1711,7 @@ function wf_edit_meta($args) {
'intro' => 'Y',
'postcontrols' => 'Y',
'pagecontrols' => 'Y',
'usercontrols' => 'N',
'adminlink' => 'Y',
'widgetslink' => 'Y',
'wfcontrols' => 'N',
@@ -1787,6 +1788,10 @@ function wf_edit_meta($args) {
$output .= $liclass . esc_attr__('PAGES:', 'wonderflux') . ' <a href="' . wp_sanitize_redirect($this_admin) . 'post-new.php?post_type=page" title="' . esc_attr__('Create new page', 'wonderflux') . '">' . esc_attr__('New', 'wonderflux') . '</a> | <a href="' . wp_sanitize_redirect($this_admin) . 'edit.php?post_type=page" title="' . esc_attr__('Edit existing pages', 'wonderflux') . '">' . esc_attr__('Edit', 'wonderflux') . '</a></li>';
}
if ( current_user_can('edit_users') && $usercontrols == 'Y' ) {
$output .= $liclass . '<a href="' . wp_sanitize_redirect($this_admin) . 'users.php" title="' . esc_attr__('Edit users', 'wonderflux') . '">' . esc_attr__('Edit users', 'wonderflux') . '</a></li>';
}
if ( current_user_can('publish_posts') && $adminlink == 'Y' ) {
$output .= $liclass . '<a href="' . wp_sanitize_redirect($this_admin) . '" title="' . esc_attr__('Website admin area', 'wonderflux') . '">' . esc_attr__('Admin area', 'wonderflux') . '</a></li>';
}

0 comments on commit 8237199

Please sign in to comment.