Skip to main content
replaced http://drupal.stackexchange.com/ with https://drupal.stackexchange.com/
Source Link

Ok. Thanks again to Pierre.Viriens who provided the perfect answer. I wasn't too familiar with the "Drupal is initializing" event but it did the trick and the link he provided How to specify a Rules condition before creating new contentHow to specify a Rules condition before creating new content was very helpful. Of course, I had to play with it and adapt it to my own circumstances to make it work. For those who are interested, I am reproducing the export of the final rule below:

{ "rules_private_messages_send_authorization_check" : {
    "LABEL" : "Private messages send authorization check",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules" ],
    "ON" : { "init" : [] },
    "IF" : [
      { "text_matches" : { "text" : [ "site:current-page:url" ], "match" : "messages\/new" } },
      { "AND" : [] },
      { "data_is_empty" : { "data" : [ "site:current-user:field-user-image" ] } },
      { "AND" : [] },
      { "NOT data_is" : {
          "data" : [ "site:current-user:roles" ],
          "value" : { "value" : { "9" : "9" } }
        }
      }
    ],
    "DO" : [ { "redirect" : { "url" : "message\/new" } } ]
  }
}

Note the two similar paths. The first one ("messages/new") is the Privatemsg module path for accessing the new message page (notice "messages" is plural.) The second "message/new" (singular) is the path of the node (article or page) I created. It is on this node that I can enter any message I want (and even include pictures and graphics too.)

If a user who does NOT have a profile picture tries to beat the system and adds an "s" to make the path read "messages/new" on the URL address bar he is redirected to a "You are not authorized to access...." default error page.

The value of "9" in the rule is assigned by the Rules module and corresponds to the name of new role I created for users who do not have a profile picture (see UPDATE above.)

All of this results in the user being sent to the module's "messages/new" page where he can send a message if he has a profile image or to the "message/new" page if he doesn't. Once there, he can't send a message and is informed why this is so.

I have thoroughly tested this rule and it operates flawlessly. The three conditions are necessary in my case.

Thanks you @Pierre.Viriens.

Ok. Thanks again to Pierre.Viriens who provided the perfect answer. I wasn't too familiar with the "Drupal is initializing" event but it did the trick and the link he provided How to specify a Rules condition before creating new content was very helpful. Of course, I had to play with it and adapt it to my own circumstances to make it work. For those who are interested, I am reproducing the export of the final rule below:

{ "rules_private_messages_send_authorization_check" : {
    "LABEL" : "Private messages send authorization check",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules" ],
    "ON" : { "init" : [] },
    "IF" : [
      { "text_matches" : { "text" : [ "site:current-page:url" ], "match" : "messages\/new" } },
      { "AND" : [] },
      { "data_is_empty" : { "data" : [ "site:current-user:field-user-image" ] } },
      { "AND" : [] },
      { "NOT data_is" : {
          "data" : [ "site:current-user:roles" ],
          "value" : { "value" : { "9" : "9" } }
        }
      }
    ],
    "DO" : [ { "redirect" : { "url" : "message\/new" } } ]
  }
}

Note the two similar paths. The first one ("messages/new") is the Privatemsg module path for accessing the new message page (notice "messages" is plural.) The second "message/new" (singular) is the path of the node (article or page) I created. It is on this node that I can enter any message I want (and even include pictures and graphics too.)

If a user who does NOT have a profile picture tries to beat the system and adds an "s" to make the path read "messages/new" on the URL address bar he is redirected to a "You are not authorized to access...." default error page.

The value of "9" in the rule is assigned by the Rules module and corresponds to the name of new role I created for users who do not have a profile picture (see UPDATE above.)

All of this results in the user being sent to the module's "messages/new" page where he can send a message if he has a profile image or to the "message/new" page if he doesn't. Once there, he can't send a message and is informed why this is so.

I have thoroughly tested this rule and it operates flawlessly. The three conditions are necessary in my case.

Thanks you @Pierre.Viriens.

Ok. Thanks again to Pierre.Viriens who provided the perfect answer. I wasn't too familiar with the "Drupal is initializing" event but it did the trick and the link he provided How to specify a Rules condition before creating new content was very helpful. Of course, I had to play with it and adapt it to my own circumstances to make it work. For those who are interested, I am reproducing the export of the final rule below:

{ "rules_private_messages_send_authorization_check" : {
    "LABEL" : "Private messages send authorization check",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules" ],
    "ON" : { "init" : [] },
    "IF" : [
      { "text_matches" : { "text" : [ "site:current-page:url" ], "match" : "messages\/new" } },
      { "AND" : [] },
      { "data_is_empty" : { "data" : [ "site:current-user:field-user-image" ] } },
      { "AND" : [] },
      { "NOT data_is" : {
          "data" : [ "site:current-user:roles" ],
          "value" : { "value" : { "9" : "9" } }
        }
      }
    ],
    "DO" : [ { "redirect" : { "url" : "message\/new" } } ]
  }
}

Note the two similar paths. The first one ("messages/new") is the Privatemsg module path for accessing the new message page (notice "messages" is plural.) The second "message/new" (singular) is the path of the node (article or page) I created. It is on this node that I can enter any message I want (and even include pictures and graphics too.)

If a user who does NOT have a profile picture tries to beat the system and adds an "s" to make the path read "messages/new" on the URL address bar he is redirected to a "You are not authorized to access...." default error page.

The value of "9" in the rule is assigned by the Rules module and corresponds to the name of new role I created for users who do not have a profile picture (see UPDATE above.)

All of this results in the user being sent to the module's "messages/new" page where he can send a message if he has a profile image or to the "message/new" page if he doesn't. Once there, he can't send a message and is informed why this is so.

I have thoroughly tested this rule and it operates flawlessly. The three conditions are necessary in my case.

Thanks you @Pierre.Viriens.

added 16 characters in body
Source Link
user14666
  • 720
  • 3
  • 16

Ok. Thanks again to Pierre.Viriens who provided the perfect answer. I wasn't too familiar with the "Drupal is initializing" event but it did the trick and the link he provided How to specify a Rules condition before creating new content was very helpful. Of course, I had to play with it and adapt it to my own circumstances to make it work. For those who are interested, I am reproducing the export of the final rule below:

{ "rules_private_messages_send_authorization_check" : {
    "LABEL" : "Private messages send authorization check",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules" ],
    "ON" : { "init" : [] },
    "IF" : [
      { "text_matches" : { "text" : [ "site:current-page:url" ], "match" : "messages\/new" } },
      { "AND" : [] },
      { "data_is_empty" : { "data" : [ "site:current-user:field-user-image" ] } },
      { "AND" : [] },
      { "NOT data_is" : {
          "data" : [ "site:current-user:roles" ],
          "value" : { "value" : { "9" : "9" } }
        }
      }
    ],
    "DO" : [ { "redirect" : { "url" : "message\/new" } } ]
  }
}

Note the two similar paths. The first one ("messages/new") is the Privatemsg module path for accessing the new message page (notice "messages" is plural.) The second "message/new" (singular) is the path of the node (article or page) I created. It is on this node that I can enter any message I want (and even include pictures and graphics too.) 

If thea user who does NOT have a profile picture tries to beat the system and entersadds an "s" to make the path read "messages/new" on the URL address bar he is redirected to a "You are not authorized to access...." default error page.

The value of "9" in the rule is assigned by the Rules module and corresponds to the name of new role I created for users who do not have a profile picture (see UPDATE above.)

All of this results in the user being sent to the module's "messages/new" page where he can send a message if he has a profile image or to the "message/new" page if he doesn't. Once there, he can't send a message and is informed why this is so.

I have thoroughly tested this rule and it operates flawlessly. The three conditions are necessary in my case.

Thanks you @Pierre.Viriens.

Ok. Thanks again to Pierre.Viriens who provided the perfect answer. I wasn't too familiar with the "Drupal is initializing" event but it did the trick and the link he provided How to specify a Rules condition before creating new content was very helpful. Of course, I had to play with it and adapt it to my own circumstances to make it work. For those who are interested, I am reproducing the export of the final rule below:

{ "rules_private_messages_send_authorization_check" : {
    "LABEL" : "Private messages send authorization check",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules" ],
    "ON" : { "init" : [] },
    "IF" : [
      { "text_matches" : { "text" : [ "site:current-page:url" ], "match" : "messages\/new" } },
      { "AND" : [] },
      { "data_is_empty" : { "data" : [ "site:current-user:field-user-image" ] } },
      { "AND" : [] },
      { "NOT data_is" : {
          "data" : [ "site:current-user:roles" ],
          "value" : { "value" : { "9" : "9" } }
        }
      }
    ],
    "DO" : [ { "redirect" : { "url" : "message\/new" } } ]
  }
}

Note the two similar paths. The first one ("messages/new") is the Privatemsg module path for accessing the new message page (notice "messages" is plural.) The second "message/new" (singular) is the path of the node (article or page) I created. It is on this node that I can enter any message I want (and even include pictures and graphics too.) If the user who does NOT have a profile picture tries to beat the system and enters the path "messages/new" on the URL address bar he is redirected to a "You are not authorized to access...." default error page.

The value of "9" in the rule is assigned by the Rules module and corresponds to the name of new role I created for users who do not have a profile picture (see UPDATE above.)

All of this results in the user being sent to the module's "messages/new" page where he can send a message if he has a profile image or to the "message/new" page if he doesn't. Once there, he can't send a message and is informed why this is so.

I have thoroughly tested this rule and it operates flawlessly. The three conditions are necessary in my case.

Thanks you @Pierre.Viriens.

Ok. Thanks again to Pierre.Viriens who provided the perfect answer. I wasn't too familiar with the "Drupal is initializing" event but it did the trick and the link he provided How to specify a Rules condition before creating new content was very helpful. Of course, I had to play with it and adapt it to my own circumstances to make it work. For those who are interested, I am reproducing the export of the final rule below:

{ "rules_private_messages_send_authorization_check" : {
    "LABEL" : "Private messages send authorization check",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules" ],
    "ON" : { "init" : [] },
    "IF" : [
      { "text_matches" : { "text" : [ "site:current-page:url" ], "match" : "messages\/new" } },
      { "AND" : [] },
      { "data_is_empty" : { "data" : [ "site:current-user:field-user-image" ] } },
      { "AND" : [] },
      { "NOT data_is" : {
          "data" : [ "site:current-user:roles" ],
          "value" : { "value" : { "9" : "9" } }
        }
      }
    ],
    "DO" : [ { "redirect" : { "url" : "message\/new" } } ]
  }
}

Note the two similar paths. The first one ("messages/new") is the Privatemsg module path for accessing the new message page (notice "messages" is plural.) The second "message/new" (singular) is the path of the node (article or page) I created. It is on this node that I can enter any message I want (and even include pictures and graphics too.) 

If a user who does NOT have a profile picture tries to beat the system and adds an "s" to make the path read "messages/new" on the URL address bar he is redirected to a "You are not authorized to access...." default error page.

The value of "9" in the rule is assigned by the Rules module and corresponds to the name of new role I created for users who do not have a profile picture (see UPDATE above.)

All of this results in the user being sent to the module's "messages/new" page where he can send a message if he has a profile image or to the "message/new" page if he doesn't. Once there, he can't send a message and is informed why this is so.

I have thoroughly tested this rule and it operates flawlessly. The three conditions are necessary in my case.

Thanks you @Pierre.Viriens.

added 87 characters in body
Source Link
user14666
  • 720
  • 3
  • 16

Ok. Thanks again to Pierre.Viriens who provided the perfect answer. I wasn't too familiar with the "Drupal is initializing" event but it did the trick and the link he provided How to specify a Rules condition before creating new content was very helpful. Of course, I had to play with it and adapt it to my own circumstances to make it work. For those who are interested, I am reproducing the export of the final rule below:

{ "rules_private_messages_send_authorization_check" : {
    "LABEL" : "Private messages send authorization check",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules" ],
    "ON" : { "init" : [] },
    "IF" : [
      { "text_matches" : { "text" : [ "site:current-page:url" ], "match" : "messages\/new" } },
      { "AND" : [] },
      { "data_is_empty" : { "data" : [ "site:current-user:field-user-image" ] } },
      { "AND" : [] },
      { "NOT data_is" : {
          "data" : [ "site:current-user:roles" ],
          "value" : { "value" : { "9" : "9" } }
        }
      }
    ],
    "DO" : [ { "redirect" : { "url" : "message\/new" } } ]
  }
}

Note the two similar paths. The first one ("messages/new") is the Privatemsg module path for accessing the new message page (notice "messages" is plural.) The second ("message"message/new") - singular -(singular) is the path of the node (article or page) I created. It is on this node that I can enter any message I want (and even include pictures and graphics too.) If the user who does NOT have a profile picture tries to beat the system and enters the path "messages/new" on the URL address bar he is redirected to a "You are not authorized to access...." default error page.

The value of "9" in the rule is assigned by the Rules module and corresponds to the name of new role I created for thoseusers who do not have a profile picture (see UPDATE above.)

All of this results in the user being sent to the module's "messages/new" page where he can send a message if he has a profile image or to the "message/new" page if he doesn't where. Once there, he can't send a message and is informed why this is so.

I have thoroughly tested this rule and it operates flawlessly. The three conditions are necessary in my case.

Thanks you @Pierre.Viriens.

Ok. Thanks again to Pierre.Viriens who provided the perfect answer. I wasn't too familiar with the "Drupal is initializing" event but it did the trick and the link he provided How to specify a Rules condition before creating new content was very helpful. Of course, I had to play with it and adapt it to my own circumstances to make it work. For those who are interested, I am reproducing the export of the final rule below:

{ "rules_private_messages_send_authorization_check" : {
    "LABEL" : "Private messages send authorization check",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules" ],
    "ON" : { "init" : [] },
    "IF" : [
      { "text_matches" : { "text" : [ "site:current-page:url" ], "match" : "messages\/new" } },
      { "AND" : [] },
      { "data_is_empty" : { "data" : [ "site:current-user:field-user-image" ] } },
      { "AND" : [] },
      { "NOT data_is" : {
          "data" : [ "site:current-user:roles" ],
          "value" : { "value" : { "9" : "9" } }
        }
      }
    ],
    "DO" : [ { "redirect" : { "url" : "message\/new" } } ]
  }
}

Note the two similar paths. The first one ("messages/new") is the Privatemsg module path for accessing the new message page (notice "messages" is plural.) The second ("message/new") - singular - is the path of the node (article or page) I created. It is on this node that I can enter any message I want (and even include pictures and graphics too.) If the user who does NOT have a profile picture tries to beat the system and enters the path "messages/new" on the URL address bar he is redirected to a "You are not authorized...." default page.

The value of "9" in the rule is the name of new role I created for those who do not have a profile picture (see UPDATE above.)

All of this results in the user being sent to the module's "messages/new" page where he can send a message if he has a profile image or to "message/new" if he doesn't where he can't send a message and is informed why this is so.

I have thoroughly tested this rule and it operates flawlessly. The three conditions are necessary.

Thanks you @Pierre.Viriens.

Ok. Thanks again to Pierre.Viriens who provided the perfect answer. I wasn't too familiar with the "Drupal is initializing" event but it did the trick and the link he provided How to specify a Rules condition before creating new content was very helpful. Of course, I had to play with it and adapt it to my own circumstances to make it work. For those who are interested, I am reproducing the export of the final rule below:

{ "rules_private_messages_send_authorization_check" : {
    "LABEL" : "Private messages send authorization check",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules" ],
    "ON" : { "init" : [] },
    "IF" : [
      { "text_matches" : { "text" : [ "site:current-page:url" ], "match" : "messages\/new" } },
      { "AND" : [] },
      { "data_is_empty" : { "data" : [ "site:current-user:field-user-image" ] } },
      { "AND" : [] },
      { "NOT data_is" : {
          "data" : [ "site:current-user:roles" ],
          "value" : { "value" : { "9" : "9" } }
        }
      }
    ],
    "DO" : [ { "redirect" : { "url" : "message\/new" } } ]
  }
}

Note the two similar paths. The first one ("messages/new") is the Privatemsg module path for accessing the new message page (notice "messages" is plural.) The second "message/new" (singular) is the path of the node (article or page) I created. It is on this node that I can enter any message I want (and even include pictures and graphics too.) If the user who does NOT have a profile picture tries to beat the system and enters the path "messages/new" on the URL address bar he is redirected to a "You are not authorized to access...." default error page.

The value of "9" in the rule is assigned by the Rules module and corresponds to the name of new role I created for users who do not have a profile picture (see UPDATE above.)

All of this results in the user being sent to the module's "messages/new" page where he can send a message if he has a profile image or to the "message/new" page if he doesn't. Once there, he can't send a message and is informed why this is so.

I have thoroughly tested this rule and it operates flawlessly. The three conditions are necessary in my case.

Thanks you @Pierre.Viriens.

deleted 1 character in body
Source Link
user14666
  • 720
  • 3
  • 16
Loading
added 36 characters in body
Source Link
user14666
  • 720
  • 3
  • 16
Loading
added 33 characters in body
Source Link
user14666
  • 720
  • 3
  • 16
Loading
added 87 characters in body
Source Link
user14666
  • 720
  • 3
  • 16
Loading
added 144 characters in body
Source Link
user14666
  • 720
  • 3
  • 16
Loading
Source Link
user14666
  • 720
  • 3
  • 16
Loading