Welcome to Geeklog, Anonymous Sunday, November 24 2024 @ 09:30 am EST
Geeklog Forums
Allow owner change of all items
Page navigation
tokyoahead
Please tell me what you think. This could become a plugin, but I rather count on it beeing implemented into the core.
to implement this, one could either simply write another function that lets you choose the item to change from here. Otherwise, one would have to edit the admin pages and insert a link that would point to this function.
# call this as :
# http://yoursite.com/staticpages/index.php?page=changeowner&changewhat=stories&item_id=20041018095452567¤t_owner=2
# $what has to be one of the following: "comments", "events", "stories", "links"
$action=$_GET['action'];
if (!SEC_inGroup('Root')) {exit;}
if (empty($action)) {$action="select_new_owner";}
return $action();
function select_new_owner()
{
global $_TABLES;
$what=$_GET['changewhat'];
$item_id=$_GET['item_id'];
$current_owner=$_GET['current_owner'];
$table=$_TABLES[$what];
$out.=COM_startBlock("Please select a new Owner of this $what:");
$user_sql="SELECT * FROM {$_TABLES['users']} ORDER by `username`;";
$user_records=DB_query($user_sql);
$out.="<FORM action=\"./index.php\" method=\"GET\">\n";
$out.="<input type=\"hidden\" name=\"page\" value=\"changeowner\">\n";
$out.="<input type=\"hidden\" name=\"table\" value=\"$what\">\n";
$out.="<input type=\"hidden\" name=\"action\" value=\"save_new_owner\">\n";
$out.="<input type=\"hidden\" name=\"item_id\" value=\"$item_id\">\n";
$out.="Username: <select name=\"new_uid\">\n";
for ($i=0;$i<DB_numRows($user_records);$i++)
{
$A=DB_fetchArray($user_records);
$username=$A['username'];
$u_id=$A['uid'];
if ($current_owner==$u_id) {$sel=" selected";} else {$sel="";}
$out.="<option value=\"$u_id\"$sel>$username</option>\n";
}
$out.="</select><input type=\"submit\"></form>";
$out.=COM_endBlock();
return $out;
}
function save_new_owner()
{
global $_TABLES;
$what=$_GET['table'];
$table_id=substr($what,0,1) . "id";
$table=$_TABLES[$what];
$item_id=$_GET['item_id'];
$new_uid=$_GET['new_uid'];
$update_sql="UPDATE $table SET uid=$new_uid WHERE $table_id='$item_id' LIMIT 1";
DB_query($update_sql);
$out="The ID has been changed!";
return $out;
}
Martinez
Hmm... Strange, but when I try to save a new static page with this code, my browser hangs out And worse - I don't know why... Writing simple static page works fine. Even static page with Your code to list inactive users (found on forum somewhere ) works and browser doesn't hangs while saving that page.
Maybe plugin (if no core implementation is made in the future) is a better way to implement this function
tokyoahead
Just from saving it?
there must be something weird. It works fine here.
Martinez
Yes, I know that's weird, cause It looks fine for me too.
I've must upgrade my geeklog to 1.3.10 final release first (RC1 using), but I don't have time (I've made some modification in core files without proper documentation and looks, like I've must do it again after upgrade ). After that I try it again
vinny
I've must upgrade my geeklog to 1.3.10 final release first (RC1 using), but I don't have time (I've made some modification in core files without proper documentation and looks, like I've must do it again after upgrade ). After that I try it again
Remember, "diff" is your friend!
-Vinny
tokyoahead
Access to this page is denied. Either the page has been moved/removed or you do not have sufficient permissions.
make sure you set the ID of the static page to "changeowner".
Robin
Running GL 1.3.11.
Anyone else has the same issue?
Geeklog Polish Support Team
tokyoahead
http://tokyoahead.com/main/filemgmt/singlefile.php?lid=36
Robin
original code (fragment)
."<input type=\"hidden\" name=\"page\" value=\"$page\">\n"
."<input type=\"hidden\" name=\"action\" value=\"select_object\">\n"
."What do you want to change: <select name=\"what\">\n"
."<option value=\"stories\">story</option>\n"
after saving you have this
."<input type="hidden" name="page" value="$page">n"
."<input type="hidden" name="action" value="select_object">n"
."What do you want to change: <select name="what">n"
."<option value="stories">story</option>n"
and the following error appears after clicking on this page
Parse error: parse error, unexpected '{' in /my/path/to/geeklog/web/html/staticpages/index.php(56) : eval()'d code on line 44
Geeklog Polish Support Team
tokyoahead
You could alter the code and change the out double quotes that concatenate into single quotes and remove then the slashes in front of the inner double quotes.
tokyoahead
anyhow its completely new to me that a PHP-enable static page would strip ANYTHING.
1000ideen
Next problem is what is that link supposed to be called? Is the example id=20041018095452567 the id of the static page or the item to be changed?
Is the '$what' is the word 'what' in 'changewhat' ?
# call this as :
# http://yoursite.com/staticpages/index.php?page=changeowner&changewhat=stories&item_id=20041018095452567¤t_owner=2
# $what has to be one of the following: "comments", "events", "stories", "links"
tokyoahead
changeowner
1000ideen
Changing the owner is just one part of the game. The other one is "I don`t see any blocks (-> help me with my account settings)" or "I can`t upload my userpic."
So I think the root user acting as user is an ideal tool and should solve all of the problems before.
tokyoahead
1000ideen
Anyway, I think that a bunch of online tech tools for the admin would be very nice. Maybe one could design a block with tools like the Admin Toolbox: http://gplugs.pigstye.net/staticpages/index.php/20030301113613982
There are a few more tools like the 'group access tool' or the 'bulk group admin' or your 'owner change tool' and maybe 'Staticpage to Access error.log' http://www.geeklog.net/article.php/ErrorLogHack
The point is the more you deal with the details the more you dare looking into the MySQL itself.
tokyoahead
Page navigation
- Normal Topic
- Sticky Topic
- Locked Topic
- New Post
- Sticky Topic W/ New Post
- Locked Topic W/ New Post
- View Anonymous Posts
- Able to post
- Filtered HTML Allowed
- Censored Content