Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8098097
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T21:58:27+00:00 2026-06-05T21:58:27+00:00

Alright, here I am again trying to write code from scratch and I can’t

  • 0

Alright, here I am again trying to write code from scratch and I can’t get it exactly right… All I want to do is retrieve the group id that the user is in (excluding registered users) and then use that in the following statements: If the retrieved group_id is 10 then return specified message else remove the user from the retrieved group_id and place them into group_id 10. This is what I have so far, but I think I’ve made an error somewhere in the dbal… and as for the user group add/del functions, I’m not sure I’m using them right… also I included the functions_user.php but wasn’t sure I really needed to or if I placed it correctly. Well here’s what I’ve got, any help?

    $integer = 2;

    $sql = 'SELECT group_id FROM ' . USER_GROUP_TABLE . '
            WHERE user_id = ' . (int) $user->data['user_id'] . "
            AND group_id != '" . (int) $integer . "'";
    $result = $db->sql_query($sql);

    if ($result == 10)
    {
       $message = sprintf($user->lang['CANNOT_USE_TRAVEL_ITEM'], $this->data['name']);
    }
    else
    {
       include($phpbb_root_path . 'includes/functions_user.' . $phpEx);

       $userid = $user->data['user_id'];

       group_user_add((10), array($user_id));
       group_user_del(($result), array($user_id));

       $message = sprintf($user->lang['TRAVEL_ITEM_NOW_USE'], $this->data['name']);
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T21:58:29+00:00Added an answer on June 5, 2026 at 9:58 pm

    Alright, I got it working… here is the code. Used the group_memberships function to both eliminate the SQL query as well as providing the correct boolean result to the group_user_add and group_user_del functions.

        global $user, $shop, $db, $phpEx, $phpbb_root_path;
    
        $this->remove_item();
    
        include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
    
        if (group_memberships(10,$user->data['user_id'],true))
        {
           $message = sprintf($user->lang['CANNOT_USE_TRAVEL_ITEM'], $this->data['name']);
        }
        else
        {
           $groups = group_memberships(false,$user->data['user_id']);
           foreach ($groups as $grouprec)
           {
                   $groupid = $grouprec['group_id'];
           }
    
           group_user_add((10), array($user->data['user_id']));
           group_user_del(($groupid), array($user->data['user_id']));
    
           $message = sprintf($user->lang['TRAVEL_ITEM_NOW_USE'], $this->data['name']);
        }
    
        return $message;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Alright, so here's my problem. I'm trying to write a script in PHP that
Alright, here's what I'm trying to do. I'm attempting to write a quick build
Alright, here goes. I'm making a very basic app, and I want the user
Alright, here is the output I get: arm-none-linux-gnueabi-ld --entry=main -dynamic-linker=/system/bin/linker -rpath-link=/home/oem/android-ndk-r3/build/platforms/android-5/arch-arm/usr/lib -L/home/oem/android-ndk-r3/build/platforms/android-5/arch-arm/usr/lib -nostdlib -lstdc++
Alright I'm totally baffled. Here's my code: if ($password == $correct_password[0] && !isset($_COOKIE['user'])) {
I'm trying to generate ics-files, see sample here: http://deap.nu/myprogram.ics It validates alright here: https://icalendar.org/validator.html
Alright here's the code: //in another file void **ptr; ptr = kmalloc(sizeof(void *) *
I am wondering if someone can tweak my code to get the functionality I
Alright so here's my current code: import System.IO import System.Environment import System.Directory main =
Alright, so here is the property I have public List<String> names{ get{ lock(_names) return

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.