Error while updating user roles using json, cURL...

I am trying to update user roles using restws module. Please refer to the code given below:

    $url = "http://DRUPAL_ROOT/user/3";
    $ch = curl_init($url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_USERPWD, "restws_test1" . ":" . "password");
    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
    
    $data = array("roles" => array("3" => 3));

    //I've tried following as alternatives:
    //$data = array("roles" => array("3" => "3"));    
    //$data = array("roles" => array(3 => "3"));
    //$data = array("roles" => array(3 => 3));
    
    $data_string = json_encode($data);

    curl_setopt($ch, CURLOPT_HTTPHEADER, array (
        "Content-Type: application/json",
        "Content-Length: ".strlen($data_string)
    ));

    curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
    
    $retValue = curl_exec($ch);
    var_dump($retValue);
    curl_close($ch);
    

This code gives me following error:

[SOLVED] Any disadvantages to adding external tables to Drupal database?

Hi all! Long time PHPer, Drupal newbie here...
I have several mysql tables that I need to work with in my project, and I am considering just adding these tables to the Drupal database rather than create another database. The advantage would be having just one database so no need to switch from one DB to another all the time, plus backup would be easier. The only downside I can see potentially would be the size of DB... I expect a lot of content on the Drupal side, but only 5-6 tables on the external side with perhaps 5-6MB of data.

How do I print tokens inside of a theme?

Long story short, I'm wondering how one would go about printing a token inside of a theme.

I've tried various methods posted and looked through the api.

print '<li class="leaf"><a title="Latest News" href="'. drupal_get_token('[node:field-section:field-url]') .'/news">News</a></li>';

This seemed to be relatively close to what I was looking for, except that the token was apprently (correctly but not desired) in a 43hex format.

The token is based upon a taxonomy field if that makes a difference.

Many Drupal versions but slow module development

Hello,

Let me first say that I am asking this from the ignorance. I have recently landed in Drupal 7. Drupal is good in many things, but there's something that I don't grasp.

What's wrong with my website!!

The trouble i meet is i can not see contents on my website only if i log in.So i do not know how to solve it.

Here is the wrong information:

Node + comments + question & answers

I'm developing a website with content type that needs to have the following functionalities:

  • Custom fields (not a problem)
  • User comments (not a problem)
  • Questions (from any user) & answers (restricted to website editor/owner)

Imagine the following use case: We have a website that is publishing reviews of some products (node with custom fields) and the product page also has a section for comments and questions & answers (Q&A). I know they are quite similar but my customer wants it distinctly separated. So, the section for comments is standard and is nicely covered by Drupal's default module. However, I'm having problems finding a solution for the questions & answers section, which works like this: (1) someone reads the product description and (2) has a very specific question about the product that needs to be answered by the website editor. Therefore, answers can only be given by website editor/owner, not any (un)registered person.

Pages

Subscribe with RSS Subscribe to RSS - Drupal 7.x