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

  • Home
  • SEARCH
  • 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 8460137
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T13:31:22+00:00 2026-06-10T13:31:22+00:00

When I run the code with an admin user, the module returns what it

  • 0

When I run the code with an admin user, the module returns what it should. However, when I run it with a normal user, I get a 403 error. The module returns data from an AJAX call. I’ve already tried adding a ‘access callback’ => ‘user_access’); line to the exoticlang_chat_logger_menu() function. I’d appreciate any pointers you might have.

Thanks for the help

The AJAX call:

jQuery.ajax({
    type: 'POST',
    url: '/chatlog',
    success: exoticlangAjaxCompleted,
    data:'messageLog=' + privateMessageLogJson,
    dataType: 'json'
});

The module code:

function exoticlang_chat_logger_init(){
drupal_add_js('misc/jquery.form.js');
drupal_add_library('system', 'drupal.ajax');
}

function exoticlang_chat_logger_permission() {
  return array(
    'Save chat data' => array(
      'title' => t('Save ExoticLang Chat Data'),
      'description' => t('Send private message on chat close')
    ),
  );
}

/**
 * Implementation of hook_menu().
 */

function exoticlang_chat_logger_menu() {
    $items = array();
    $items['chatlog'] = array(
    'type'             => MENU_CALLBACK,
    'page callback'    => 'exoticlang_chat_log_ajax',
    'access arguments' => 'Save chat data');
    //'access callback' => 'user_access');
    return $items;
}

function exoticlang_chat_logger_ajax(){
    $messageLog=stripslashes($_POST['messageLog']);

    $chatLog= 'Drupal has processed this. Message log is: '.$messageLog;
    $chatLog=str_replace('":"{[{','":[{',$chatLog);
    $chatLog=str_replace(',,',',',$chatLog);
    $chatLog=str_replace('"}"','"}',$chatLog);
    $chatLog=str_replace('"}]}"','"}]',$chatLog);

     echo json_encode(array('messageLog' => $chatLog));
//    echo $chatLog;

    echo print_r(privatemsg_new_thread(array(user_load(1)), 'The subject', 'The body text'));
    drupal_exit();
}
  • 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-10T13:31:23+00:00Added an answer on June 10, 2026 at 1:31 pm

    access arguments needs to be an array:

    $items['chatlog'] = array(
      'type'             => MENU_CALLBACK,
      'page callback'    => 'exoticlang_chat_log_ajax',
      'access arguments' => array('Save chat data')
    );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When I run the following code user = users.get_current_user() if users.is_current_user_admin(): loggedin = 'Admin'
I'm trying to write some code that will be run by the 'admin' user
We run code from adress 8002000 to 80020028 and the question is what is
I am using to compile and run code from Features2D + Homography to find
When I run the code below, a new User with the expected properties is
I want to start a Process with Admin rights. When I run the code
Why is this code crashing when run as a restricted user, but not when
I want to run code which needs boost libraries. I built it using CMake.
how can i run code when an application ends with asp.net mvc ?
i need run code that will create a database and populate tables. i am

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.