Looking for a campaign
Code
Edit the action search in the file actions/search.php to protect the access to a campaign:
- require_once 'userprofile.php';
Loads the function user_profile.
- if ($thread_type == 'campaign') {
- if (!(user_has_role('administrator') or (user_has_role('client') and $thread_user_id == user_profile('id')))) {
- return run('error/notfound', $lang);
- }
- $cloud_name=$cloud_id;
- }
If the thread is a campaign and if the user is not an administrator or not the client who owns the thread, returns a protocol error.
Edit the model cloud to forbid accessing the keywords of a campaign like for the RSS thread or the thread of the newsletters:
Modify the code of the functions cloud_list_tags, cloud_search and cloud_match in the file models/cloud.inc to forbid accessing the keywords of a campaign:
- $join2 .= " AND t.thread_type!='rss' AND t.thread_type!='newsletter' AND t.thread_type!='campaign'";
- $join2 .= " AND t.thread_type!='rss' AND t.thread_type!='newsletter' AND t.thread_type!='campaign'";
- $join2 .= " AND t.thread_type!='rss' AND t.thread_type!='newsletter' AND t.thread_type!='campaign'";
To forbid global searching, i.e. calling the action search without a thread in parameter, set the configuration parameter $search_all to 'cloud' in config.inc:
- $search_all='cloud'; // true, false, 'cloud'
Test
Connect
as an administrator.
Enter in the management
part of the site.
Management
Content
Click on the large phone.
Advertisers
Enter izend in the search box. Click the magnifying glass
to display the list of campaigns of this advertiser containing the term izend.
Try clicking on one of the keywords in the cloud. Clear the input field and press Enter.
Click on the logo to display the home page.
Click the magnifying glass
to display the list of all the terms in the index.
The page is empty. The terms associated to campaigns are not published.
Git
- /izendsms.com
- actions
- search.php
- includes
- includes.inc
- models
- cloud.inc
- actions
Commit this version:
$ git status
$ git add --update
$ git commit -m'Adds searching campaigns'

Comments