You are missing our premiere tool bar navigation system! Register and use it for FREE!

•  Home •  Downloads •  Gallery •  Your Account •  Forums • 
Readme First
- Readme First! -

Read and follow the rules, otherwise your posts will be closed
· Home
· Buy a Theme
· Advertising
· AvantGo
· Bookmarks
· Columbia
· Community
· Donations
· Downloads
· Feedback
· Forums
· Private Messages
· Search
· Statistics
· Stories Archive
· Submit News
· Surveys
· Theme Gallery
· Top
· Topics
· Your Account
Who's Online
There are currently, 423 guest(s) and 0 member(s) that are online.

You are Anonymous user. You can register for free by clicking here
How to allow anonymous web link submissions

26.6. How to allow anonymous web link submissions

Figure 26-5. Administration panel: Web Links.

Administration panel: Web Links.

Suppose you need to allow anonymous users to submit web links that then must be approved by an Administrator. Is this possible with the vanilla install of PHP-Nule?

It turns out that yes, it is - very easily indeed! But instead of just presenting you the solution, we will also describe how we arrived at it (see Anonymous Web Link Submissions):

We first thought that if the Web Links module was visible by all visitors, it would also allow them to suggest a link. We tried it, but we got the error:

You are not a registered user or you have not logged in.

If you were registered you could add links on this website.

Becoming a registered user is a quick and easy process.

Why do we require registration for access to certain features?

So we can offer you only the highest quality content,

each item is individually reviewed and approved by our staff.

We hope to offer you only valuable information.

Obviously, PHP-Nuke made a check if this was a registered user - and issued that statement. But where was this check located in the code?

To find it, we used the same bottom-up approach of Section 3.9.6 and Section 26.5:

We first had to find the place where the above error was echoed. We thus searched the whole code tree for all occurences of a word that most probably would appear only in the error above - we chose the word "valuable". It turned out that the word "valuable" was in some unrelated text consntants - but it was also in the _LINKSNOTUSER7 text constant that was translated in all modules/Web_Links/language/lang-XXXX.php files!

Armed with this information, we only had to do a second search, this time for all occurences of the string "_LINKSNOTUSER" in the whole code tree of PHP-Nuke. We got again dozens of language files in the output, but we also got the modules/Web_Links/index.php file. Indeed, if at all, it must be this file where the check is made!

We thus checked the relevant lines of modules/Web_Links/index.php and the code went like this:

if (is_user($user) || $links_anonaddlinklock == 1) {
--> do the work here <--
}else {
    echo "<center>"._LINKSNOTUSER1."<br>"

So that's where the check is made! You can see it for yourself, because the code is almost speaking natural language:

If is user or anon add link

We first thought we had to remove the check "if is user", but then we saw that "or $links_anonaddlinklock == 1" which made us suspicious. So there was some kind of configuration variable ( $links_anonaddlinklock) which can control the outcome of the test!

We know from experience that such variables are set in a separate PHP file, in the same folder of the module. If you didn't have this experience, then you would just have to do a third search for all occurences of the string "links_anonaddlinklock" in the text of all files - there shouldn't be that many.

Indeed, $links_anonaddlinklock is set in modules/Web_Links/l_config.php:

# $links_anonaddlinklock:       Lock Unregistered users from Suggesting New Links? 
                                (0=Yes 1=No)
...many other comments
...many other variables
$links_anonaddlinklock = 0;

So you just have to set

$links_anonaddlinklock = 1;

in modules/Web_Links/l_config.php and any user, also unregistered ones, will be able to suggest Web Links!

Tip A general approach to problem solving

You can use this bottom-up approach to solve many similar problems of your daily work as an administrator of a PHP-Nuke system.

Help us make a better PHP-Nuke HOWTO!

Want to contribute to this HOWTO? Have a suggestion or a solution to a problem that was not treated here? Post your comments on my PHP-Nuke Forum!

Chris Karakas, Maintainer PHP-Nuke HOWTO

Web site engine's code is Copyright © 2002 by PHP-Nuke. All Rights Reserved. PHP-Nuke is Free Software released under the GNU/GPL license.
Page Generation: 1.176 Seconds - 334 pages served in past 5 minutes. Nuke Cops Founded by Paul Laudanski (Zhen-Xjell)
:: FI Theme :: PHP-Nuke theme by coldblooded ( ::