This page looks best with JavaScript enabled

Scuttle - Remove Spam Accounts (aka the admin interface)

 ·  ☕ 3 min read

Background

Scuttle is an open source bookmark manager (see What is Scuttle?). If you set up your own scuttle instance on your public web server you will no doubt run into spammers who create their own accounts for illicit purposes. This entry shows how you can enhance scuttle to provide a scuttle page for administering users (e.g. remove users).

Details

To patch scuttle to include the ‘remove user’ screen head over to scuttle’s patch forum and go to Patch ID: 1543065. The page provides details on how to patch your scuttle instance to include the ‘remove user’ page.

Issues

I ran into a few issues, see the following list for tips:

  • see warenhaus' comment regarding adding the ‘uAdmin’ field
  • to apply the patch, issue the ‘patch patchfile’ command on a linux host as the patch file contains multiple changes - changes to multiple files

Enhancements

After using the scuttle admin interface a bit, I’ve found the need to enhance a few options. This section lists my enhancements.

Remove Admin User from List

After getting the ‘remove user’ admin screen working I was a bit displeased to see the admin account in the list of users to delete (I would hate to delete or have this account deleted) so I made a slight modification to remove this user from the Manager Users list. To remove the admin user (or more specific, any user with the admin role) perform the following steps:

  • Open the services/userservice.php file in a text editor
  • Go to the function getAllUsers function and modify the $query string
    • from: $query = SELECT * FROM '. $this->getTableName();
  • to: `$query = SELECT * FROM '. $this->getTableName() .' WHERE uAdmin != 1' or uAdmin IS NULL;` * Save the changes to the `userservice.php` file

    That is it, now any user with the admin role (e.g. uAdmin=1) will not be displayed in the Manager Users list.

    Show Extended User Info in Admin Interface

    I found myself needing more info about the users in the user list (e.g. name, email, etc.) and decided to add this functionality to the admin interface rather than query the database each time to find the info out. It is a rather simple hack but is extremely useful. Here are the steps:

    • in services/userservice.php, add the following items to the $fields array
    1
    2
    3
    4
    
    'email'     => 'email',
    'name'      => 'name',
    'homepage'  => 'homepage',
    'description => 'uContent'
    
    • in templates/userlist.tpl.php, add the following directly after the $users[$key][$userservice->getFieldname('username')]).'">'.$users[$key][$userservice->getFieldName('userna$username')].''; line (you can add it where you like but this is a convenient place:
    1
    2
    3
    4
    
    echo ' <br/>&nbsp;&nbsp;email: '.$users[$key][$userservice->getFieldname('email')].'';
    echo ' <br/>&nbsp;&nbsp;name: '.$users[$key][$userservice->getFieldname('name')].'';
    echo ' <br/>&nbsp;&nbsp;homepage: '.$users[$key][$userservice->getFieldname('homepage')].'';
    echo ' <br/>&nbsp;&nbsp;description: '.$users[$key][$userservice->getFieldname('description')].'';
    
    • refresh the admin.php page and you should now see the above added info to the admin users list.
  • Share on

    drad
    WRITTEN BY
    drad
    Sr. Consultant