CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Help! I "don't have permission to execute this url"
Pages: [1]

Author Topic: Help! I "don't have permission to execute this url"  (Read 855 times)

numonium

  • I’m new here
  • *
  • Posts: 4
  • Karma: 0
  • CiviCRM version: 3.3
  • CMS version: 3
  • MySQL version: 5
  • PHP version: 5.3
Help! I "don't have permission to execute this url"
October 23, 2013, 04:39:09 pm
I'm trying to add some custom validation to Civi Event registration form (in Wordpress, Civi is properly integrated); something to validate if a non-member has tried to get member pricing for given event.

I created a custom WP template that is a "man-in-the-middle", where it pulls down (via HTTP GET) the current form, generated by Civi, then changes the action of the form to post to the custom template, does the extra validation, and then either prints out errors, or passes the POST to Civi, via the original form action attribute and PHP cURL.

I've done all of that, except the response I get back from Civi is: "you don't have the permission to execute this URL", but if I copy and paste it into a new browser tab, the page shows. I'm not logged in, so I can't figure out what would be different between an anonymous HTTP request to Civi and one made by the server it's running on (via cURL).

So please, I'd greatly appreciate any help you could offer, since I've tried just about everything else I could think of. I've made sure anonymous users can access and register for events (on the Civi WP Admin page), and have the following options for cURL:

Code: [Select]

$ch = curl_init();
curl_setopt($ch, CURLOPT_AUTOREFERER, true);
curl_setopt($ch, CURLOPT_COOKIEFILE, '.cookie');
curl_setopt($ch, CURLOPT_REFERER,$get);
curl_setopt($ch, CURLOPT_URL, $action);
curl_setopt($ch, CURLOPT_PORT, (strpos($action, 'https://') !== false ? 443 : 80));
curl_setopt($ch, CURLOPT_VERBOSE, true);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
        curl_setopt($ch, CURLOPT_POST, true);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $post );


Here's the URL that the aforementioned POSTs to - http://new.go-gba.org/event/?page=CiviCRM&q=civicrm/event/register.

Please advise - thanks so much! :)

We're on Civi 4.3.4 and WP 3.6.1

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Help! I "don't have permission to execute this url"
October 23, 2013, 05:22:10 pm

not sure why u chose that approach.

note that civi makes it fairly easy to add custom validation via multiple methods:

a. Add some jQuery / javascript validation in the template

b. Implement the validate hook (via civi's hook system) that adds your own validation rules in php for any form

i would do either of the methods above then your approach

lobo

p.s> sorry, i dont know the answer to your specific query
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

numonium

  • I’m new here
  • *
  • Posts: 4
  • Karma: 0
  • CiviCRM version: 3.3
  • CMS version: 3
  • MySQL version: 5
  • PHP version: 5.3
Re: Help! I "don't have permission to execute this url"
October 23, 2013, 10:29:10 pm
Thanks for replying.

I chose to go the cURL route because I couldn't access Civi functions from other pages in Wordpress, even after manually including ABSPATH . /wp-content/plugins/civicrm/civicrm.php

If there's a less-painful way to get that to work, I'm game.

Perhaps you could help me get that up and running? I'd certainly appreciate it :)

numonium

  • I’m new here
  • *
  • Posts: 4
  • Karma: 0
  • CiviCRM version: 3.3
  • CMS version: 3
  • MySQL version: 5
  • PHP version: 5.3
Re: Help! I "don't have permission to execute this url"
October 23, 2013, 10:33:13 pm
From what I'm reading, there isn't support for Civi hooks in Wordpress. How else can I accomplish this functionality?

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Help! I "don't have permission to execute this url"
October 23, 2013, 10:40:23 pm
native civicrm extensions work on wordpress and they can contains hook.

Check out civix. will make it easier for you to start, and look at existing simple extensions
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

numonium

  • I’m new here
  • *
  • Posts: 4
  • Karma: 0
  • CiviCRM version: 3.3
  • CMS version: 3
  • MySQL version: 5
  • PHP version: 5.3
Re: Help! I "don't have permission to execute this url"
October 24, 2013, 10:20:55 am
Don't think I should need to write a whole extension for this, right? What I'm looking to do is somewhat simple. If there's a way I can actually reference the Civi functions from another WP template that's technically outside Civi, I'd go for that, but... anyone?

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Help! I "don't have permission to execute this url"
October 24, 2013, 11:53:02 am

extensions can be lightweight and civix gives you most of the scaffolding.

you can proceed the way you want (in WP template), but then you are venturing in areas that we dont typically do stuff in and might have to fiddle with it till u get it working

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Help! I "don't have permission to execute this url"

This forum was archived on 2017-11-26.