Welcome to Geeklog Wednesday, November 13 2019 @ 08:48 pm EST

Geeklog Forums

Update all Article Permissions to the Default Settings

Status: offline


Site Admin
Registered: 27/09/05
Posts: 1383
This is in regards to the following bug https://github.com/Geeklog-Core/geeklog/issues/967

Since Geeklog v2.0.0 the default article permissions and the Story Admin Group where not used for the default permissions when a submitted article was approved or brought up in the Article Editor. Instead the Topic Admin group and the default topic permissions for the article was used. This has now been fixed in Geeklog v2.2.1. but you must manually go through and check any previously submitted articles and update their permissions if needed.

To update all articles to the default permissions (while not updating the owner_id) create a text file with the following name "update_article_permissions.php" in the public_html directory of your geeklog install. Add the code below to the file and save it.

PHP Formatted Code


require_once 'lib-common.php';


// For Root users only
if (!SEC_inGroup('Root')) {
    $display .= COM_showMessageText($MESSAGE[29], $MESSAGE[30]);
    $display = COM_createHTMLDocument($display, array('pagetitle' => $MESSAGE[30]));
    COM_errorLog("Someone has tried to access a custom Geeklog Database Upgrade Routine without proper permissions.  User id: {$_USER['uid']}, Username: {$_USER['username']}, IP: " . $_SERVER['REMOTE_ADDR'],1);

$display = '<h1>Custom Development Database Update</h1>';

$display .= "<p><strong>Starting Process</strong></p>
            <p>Updating Article Permissions</p>"

if (isset($_GROUPS['Story Admin'])) {
    $group_id = $_GROUPS['Story Admin'];
} else {
    $group_id = SEC_getFeatureGroup('story.edit');

$A = array();
SEC_setDefaultPermissions($A, $_CONF['default_permissions_story']);

DB_query("UPDATE {$_TABLES['stories']} SET group_id = '$group_id', perm_owner = '{$A['perm_owner']}', perm_group = '{$A['perm_group']}', perm_members = '{$A['perm_members']}', perm_anon = '{$A['perm_anon']}'");

$display .= "<p><strong>Finished Process</strong></p>";


$display .= '<p>The Geeklog Custom Development Database Update has completed.</p>
             <p>Please visit the <a href="https://www.geeklog.net/forum/viewtopic.php?showtopic=97115">Geeklog Support Forums</a> if you have any questions or run into any problems.</p>'

$display = COM_createHTMLDocument($display, array('pagetitle' => $MESSAGE[40]));

Using your browser then visit the file to execute the code (you must be logged in as the Root user to run the code).

Once complete, delete the file (DO NOT FORGET THIS).
One of the Geeklog Core Developers.

All times are EST. The time is now 08:48 pm.

  • 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