From e63e4b034b6578958de9075dfd56874651e02651 Mon Sep 17 00:00:00 2001 From: mikelittle Date: Sat, 26 Jul 2003 23:52:36 +0000 Subject: [PATCH] Added the ability to assign ownership of links to another user. Help updated. git-svn-id: http://svn.automattic.com/wordpress/trunk@276 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/help/en/linkmanager.php.help.html | 8 +- wp-admin/linkmanager.php | 118 +++++++++++++++++---- 2 files changed, 102 insertions(+), 24 deletions(-) diff --git a/wp-admin/help/en/linkmanager.php.help.html b/wp-admin/help/en/linkmanager.php.help.html index a8d6b103f..c3538b808 100644 --- a/wp-admin/help/en/linkmanager.php.help.html +++ b/wp-admin/help/en/linkmanager.php.help.html @@ -65,9 +65,15 @@ after the image or name.

Additionaly, if you have sufficient privileges, Edit and - Delete buttons are displayed.

+ Delete buttons are displayed. Along with a checkbox. The + checkboxes are used in conjunction with the function buttons at the bottom + of the list of links.

+
Assign Ownership
+
This list and button allow you to assign the ownership of links (for which + you have administration privileges) to someone else.
+
diff --git a/wp-admin/linkmanager.php b/wp-admin/linkmanager.php index 78dc1ccba..f4d86ef36 100644 --- a/wp-admin/linkmanager.php +++ b/wp-admin/linkmanager.php @@ -51,7 +51,8 @@ if (!get_magic_quotes_gpc()) { $b2varstoreset = array('action','standalone','cat_id', 'linkurl', 'name', 'image', 'description', 'visible', 'target', 'category', 'link_id', - 'submit', 'order_by', 'links_show_cat_id', 'rating', 'rel', 'notes'); + 'submit', 'order_by', 'links_show_cat_id', 'rating', 'rel', + 'notes'. 'linkcheck'); for ($i=0; $i= the + //userlevel of the owner of the link then we can proceed. + + $all_links = join(',', $linkcheck); + $results = $wpdb->get_results("SELECT link_id, link_owner, user_level FROM $tablelinks LEFT JOIN $tableusers ON link_owner = ID WHERE link_id in ($all_links)"); + foreach ($results as $row) { + if ($user_level >= $row->user_level) { // ok to proceed + $ids_to_change[] = $row->link_id; + } + } + + // should now have an array of links we can change + $all_links = join(',', $ids_to_change); + $q = $wpdb->query("update $tablelinks SET link_owner='$newowner' WHERE link_id IN ($all_links)"); + + header('Location: linkmanager.php'); + break; + } case 'Add': { $standalone = 1; @@ -368,6 +396,21 @@ switch ($action) { if ($action != "popup") { ?> +
@@ -432,40 +475,31 @@ switch ($action) { - +
- + + $link->link_rel +LINKS; + $show_buttons = 1; // default + + if ($use_adminlevels && ($link->user_level > $user_level)) { + $show_buttons = 0; + } + + if ($show_buttons) { + echo << - - + + + +LINKS; + } } } ?> + +
Name URL CategoryRelationshipRel Image Visible     
$image $visible
LINKS; + } else { + echo <<   
+ + + + +
Assign ownership (of checked) to: +get_results("SELECT ID, user_login FROM $tableusers WHERE user_level > 0 ORDER BY ID"); + echo " \n"; +?> + + + Toggle Checkboxes +   + +