I am somewhat dissatisfied with the functionality of the membership levels. For example, on the menu items the only control is "public" or "members only" - nothing about membership levels. Same with the pages - there is no easy way that I know of to restrict access to certain membership levels.
I currently have three membership levels, "standard", "professional" and "business". I want my professional accounts to have access to most of of the services, but I want my business accounts to have access to some premium services. Specifically, I have a trade opportunity database I would love to integrate with D7 eventually, but for now would like to know about any good method of providing premium content to certain member levels.
I know there were some mods on Expertzzz that at least had techniques for limiting access to certain pages. Has anyone tried anything like that in D7? If anyone is working on this kind of issue I would appreciate knowing about any techniques that might work.
Rob
|
I need to do the same thing. I have a business directory script, and a
jobs portal script, both of which I need to provide access to via a
business membership level, which would be the only level allowed to pay
for posting Ads and Jobs. Standard members would have all the standard
user side options.. for free. All this is going to take a pretty tight
integration intto Dolphin because the code of both applications will
need certain functions to consider membership allowed actions. I need
to utilize membership levels because I need both applications to
authenticate users using the Dolphin DB..... the thing is, I want to
offer the Business Directory and Jobs Portal free of charge for a
while, but I don't want standard members tinkering around, or posting
spam ads. For the trial period, I want to just manually promote the
member to to business membership.
I don't think there's a good way to tie navigation menu items to
membership levels, since the membership level functionality is closely
tied to content and operations on that content. However...
It is easy to create a new membership level and add custom actions to the sys_acl_actions table:
INSERT INTO `sys_acl_actions` (`ID`, `Name`, `AdditionalParamName`) VALUES(201, 'Use Bizdirectory', NULL);
The new action 'Use Bizdirectory' will then appear on the actions list
in the admin > membership levels. Then if you enable the new
action, it will then appear in the sys_acl_matrix table, where it can
be checked by a php function, which can be used to decide whether or
not to display content on custom D7 pages (the action name will need a
language key). Controlling what those members can do on the custom
page wil take a bit more integration. You'd need to create more
actions in the sys_acl_actions table, and use those within the external
script to allow certain functionalities within that script.
Without some serious integration of the external script, I don't see
any way to do anything but to display, or not to display content via
membership allowed actions. A really useful mod, would be if someone
could create custom HTML and PHP blocks, that you could give an ID, and
each block you placed, would automatically create an entry in the
membership levels action list, and the display of that block would be
tied to the sys_acl_matrix table entry, if any. You would then add your additional code to the block. Then you could enable,
or disable the block, according to membership level in admin. I can see a lot of use for something like this. My opinions expressed on this site, in no way represent those of Boonex or Boonex employees. |
Good job - need some time to think about this one- I'm not good at code. Is Expertzzz still there? I know some people had done some free mods for this there - maybe I will hunt around there this evening and see if there is anything that might work with D7. Anyone else care to weigh in on this?
Rob
|
Followed part of that approach, but got lost at the "it will then appear in the sys_acl_matrix table, where it can
be checked by a php function, which can be used to decide whether or
not to display content on custom D7 pages" - the idea for custom php and html blocks sounds good though - where are the mod developers for D7?
As promised, I prowled around Expertzzz for a bit, and found this: http://www.expertzzz.com/Downloadz/view/2856 Not sure if anything useful can be gleaned for D7 from that though, but it seems to be on the right track.
I need to "fake this until I make it" - maybe a good place to start would be a "procedure" to make a custom php and/or html page linked to membership levels. okweb, are you around? Maybe you can jump into this. I love your cook book type recipes for this kind of thing. This needs to happen somehow - no one will ever make any money on these sites without it. Anyone one else interested in this?
Rob
|
Actually no need to download that file. All that is there is a single text file, which I have pasted below. This has a place in the middle where you can post html content, and only members above the standard level can see it. Again, it isn't much, and not even sure it will work with D7, but maybe some of the php people could take a look and put some controls for different member level names. In my case, I would like a membership name called "business" to be able to see this, and no other levels. This would at least let me fake a membership based security level - and I could put some links in that html area just for now. It is a first step...
<? /*************************************************************************** * Dolphin Smart Community Builder * ----------------- * begin : Mon Mar 23 2006 * copyright : (C) 2006 BoonEx Group * website : http://www.boonex.com/ * This file is part of Dolphin - Smart Community Builder * * Dolphin is free software. This work is licensed under a Creative Commons Attribution 3.0 License. * http://creativecommons.org/licenses/by/3.0/ * * Dolphin is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the Creative Commons Attribution 3.0 License for more details. * You should have received a copy of the Creative Commons Attribution 3.0 License along with Dolphin, * see license.txt file; if not, write to marketing@boonex.com ***************************************************************************/
require_once( 'inc/header.inc.php' ); require_once( BX_DIRECTORY_PATH_INC . 'design.inc.php' ); require_once( BX_DIRECTORY_PATH_INC . 'profiles.inc.php' ); require_once( BX_DIRECTORY_PATH_INC . 'prof.inc.php' ); require_once( BX_DIRECTORY_PATH_INC . 'profile_disp.inc.php' ); require_once( BX_DIRECTORY_PATH_INC . 'modules.inc.php' ); require_once( BX_DIRECTORY_PATH_INC . 'utils.inc.php' ); require_once( BX_DIRECTORY_PATH_INC . 'images.inc.php' );
// --------------- page variables and login
$_page['name_index'] = 25; $_page['header'] = _t('Sitemap'); $_page['header_text'] = _t(''); $_ni = $_page['name_index']; check_logged(); $bizimID = $_COOKIE['memberID']; $_page_cont[$_ni]['page_main_code'] = PageCompForum($bizimID);
function PageCompForum($a) {
global $prof; global $site;
$query2 = "SELECT IDLevel FROM ProfileMemLevels WHERE IDMember='$a'"; $sonuc = db_res($query2); $sayi = mysql_num_rows($sonuc); if ($sayi==0)
{ return <<<HTML Your current citizenship standard does not allow to view this page HTML; } else { return <<<HTML <iframe src="live.html" width="100%" height="550px" border="0" frameborder="0"> </iframe> HTML; }
}
PageCode(); ?>
|
That should work in D7 as well with a few code changes. It'll be just a go/no-go page, but it'll be better than nothing.
In D7, the sys_acl_levels_members table is the equivalent of the D6 ProfileMemLevels table.
I studied the table structure a bit, and there are 6 tables associated with memebrship level privileges.
sys_acl_actions
Stores the ID and name of every action associated with the various modules on a D7 site. If integrating another application, you can add more actions and associate an ID with that action, by running an sql query similar to the one below, on your D& database.
INSERT INTO `sys_acl_actions` (`ID`, `Name`, `AdditionalParamName`) VALUES(201, 'Use Bizdirectory', NULL);
You can add as many actions as you like to associate with membership levels. Right away, I can see some potential conflicts, somewhere down the road. The conflicts may arise when assigning ID numbers to actions. If two different mods, from two different vendors, decide to use the same action ID number, or give actions the same name, it will cause conflicts. This is probably something that needs to be planned for.
sys_acl_actions_track
This table keeps trak of how many times each user within a membership level has used a paticular action, and time limits on those actions, if such limits were imposed when creating the mebership level.
sys_acl_levels
Store the ID# and name of your D7 site membership level
sys_acl_levels_members
This table stores members by ID# and their associated membership level ID#
sys_acl_level_prices
This table stores the prices of membership levels, if any, and also the length of all membership level
sys_acl_matrix
This table is where all the actions that are stored in the sys_acl_actions table are associated to all of the membership levels stored in the sys_acl_levels table.. When you allow an action in membership levels admin, for a given membership level, this table is where that permission is recorded. In the case of a third party script integration, you can create various actions for different membership levels, then hard code those permissions into the third party script.
I plan to have a job board integrated, which can make use of membership levels. Standard users would be allowed to post resumes for free and to freely browse all the job ads. Employers would have a business membership which would allow them to post jobs, review applications and resumes, etc. Membership levels will be a great way to seperate the things job seekers and Employers can do. I'll need the same sort of seperation between business members and standard members for a business directory script I will use.
I suppose you could also use the intricacies of membership level custom functions to control how many pictures your members can look at, on your gay-nazi-biker-porn site..........
Just thought I'd write all this down while I was thinking about it.
My opinions expressed on this site, in no way represent those of Boonex or Boonex employees. |
Anton has created exactly what you are discussing (for version 6.1) which he calls Page Access Control. You can find it here:
http://www.expertzzz.com/Downloadz/view/3054
It allows for displaying blocks and menu items by membership level (up to 30 membership levels).
I'm sure he could update it for 7.X versions, but you would have thought that with a community system which is DESIGNED for differing membership levels, Dolphin should have come with controls like this already built in.
|
@Houston - good information . I agree that whatever you integrate with D7 should use the existing membership levels. In fact, the membership level architecture is why I selected Dolphin in the first place, it is just not as sophisticated as I thought at first.
@Bigal - thanks for posting that. That wouldn't solve all my issues but it would go a long way towards that. Look at the comments for that mod - people love it. I'm broke right now but will somehow scrape up $40 if this could be made available for D7. I totally agree though - D7 should have come with controls like this already built in. If you put it in as a mod there might be future compatibility issues.
Rob
p.s. Would still like some help adding named member levels to the code above so I can "fake it" until a solution is found.
|
Anton has created exactly what you are discussing (for version 6.1) which he calls Page Access Control. You can find it here:
http://www.expertzzz.com/Downloadz/view/3054
It allows for displaying blocks and menu items by membership level (up to 30 membership levels).
I'm sure he could update it for 7.X versions, but you would have thought that with a community system which is DESIGNED for differing membership levels, Dolphin should have come with controls like this already built in.
That's probably all the only kind of mod that can be done without the concerns involved in a tighter application integration that involves assigning permissible actions per membership level. The problem I pointed out, is that if mod developers build an application where you can assign various functionalities of that application to different membership levels, database conflicts are likely to arise when it comes to assigning actions, and action IDs.
This is where some forethought should be applied, and some sort of guidelines established for mod development, and third party integrations. Without some predefined framework in this area, developers will do whatever they want. This assumes of course, that all actions for every mod and integration are stored in the sys_acl_xxx tables. At the very minimum, I can see a need for each future mods or integrations, actions list and IDs, if any, be stored in a searchable repository, so that developers would know if a name they wanted to use, has been used before. On the other hand, if there were an architecture in place, where a mod or application, could store it's action list in it's own DB table, that would go a long way to alleviate this issue.
What I would really like to see, is a Guild formed by the top Dolphin developers, to discuss things like this and establish standards. The same guild could review mods submitted to unity so we all would know that mods listed here, conform to standards. I would definitely contribute financially to this sort of organization.
I know I got a little off-topic here, but sooner or later, these things need to be discusssed.
My opinions expressed on this site, in no way represent those of Boonex or Boonex employees. |
RE: - D7 should have come with controls like this already built in. If you put it in as a mod there might be future compatibility issues.
I agree that this would be a nice feature to have at the page level. I would take it a step further, and add these sort of controls to individual custom HTML and PHP blocks. Most of the built in module functions are already on the actions list in membership levels admin, so there's a lot of control built in. There shouldn't be any compatibility issues, if all you are doing is considering membership level when providing the content. As I pointed out above, conflicts are likely to arise in the future, when you have hundreds of developers using custom membership actions.
Somebody really needs to form a Dolphin Developers Guild. I'm not a software guy, but for the last three decades, I've lived in a world where conformance to standards is the golden rule.
My opinions expressed on this site, in no way represent those of Boonex or Boonex employees. |
Hi Rob, you can try this code, have made 2 different codes,
A -> will add a block to Account page with Premium content to only Business Members else it will not show anything
B -> will add a block to Account page with Premium content to Business Members and some other Premium content if you are Professional Members else it will not show anything
==============
A)
1) Add a new PHP block to Account page
Caption Lang Key: Premium content Visible for: Member
PHP content:
// Edit $MemLevelxxx = IDLevel to what you have
$Memb = $this->iMember; $MemLevelBusiness = 5;
// Business = IDLevel 5
$arr_Business = db_arr( "SELECT `ID`, `NickName` FROM `Profiles` LEFT JOIN `sys_acl_levels_members` ON ( `sys_acl_levels_members`.`IDLevel` = $MemLevelBusiness ) WHERE `sys_acl_levels_members`.`IDMember` = $Memb " );
if ( $arr_Business ) { echo " <center><br> <b>Hi {$arr_Business[NickName]},</b> Premium content only available to Business Members. </center><br> "; }
SAVE IT
2) Done
==========================================
B)
1) Add a new PHP block to Account page
Caption Lang Key: Premium content Visible for: Member
PHP content:
// Edit $MemLevelxxx = IDLevel to what you have
$Memb = $this->iMember; $MemLevelProfessional = 4; $MemLevelBusiness = 5;
// Professional = IDLevel 4
$arr_Professional = db_arr( "SELECT `ID`, `NickName` FROM `Profiles` LEFT JOIN `sys_acl_levels_members` ON ( `sys_acl_levels_members`.`IDLevel` = $MemLevelProfessional ) WHERE `sys_acl_levels_members`.`IDMember` = $Memb " );
if ( $arr_Professional ) { echo " <center><br> <b>Hi {$arr_Professional[NickName]},</b> Premium content only available to Professional Members. </center><br> "; }
// Business = IDLevel 5
$arr_Business = db_arr( "SELECT `ID`, `NickName` FROM `Profiles` LEFT JOIN `sys_acl_levels_members` ON ( `sys_acl_levels_members`.`IDLevel` = $MemLevelBusiness ) WHERE `sys_acl_levels_members`.`IDMember` = $Memb " );
if ( $arr_Business ) { echo " <center><br> <b>Hi {$arr_Business[NickName]},</b> Premium content only available to Business Members. </center><br> "; }
SAVE IT
2) Done
|
Fantastic Ottar! I will try this over this weekend. One small issue though - this won't show anything unless they are business / paying members - is that correct? I kinda want members to know they are missing something by not being business members - maybe an "upgrade your account" link or something. Still, this is great as we don't have anything like this at all right now. Thanks again for your help and your always great contributions here.
Rob
|
Simply add this code
else { echo " <center><br><b> You are Standard member: <a href=/modules/?r=membership/index/>Upgrade now</a> </b></center><br> "; }
|
Hi, has anyone tried this mod by okweb yet? I used Deano's mod for adding php blocks to the pages, then I dropped in the code as okweb described, and it generated the following on-screen error:
------ Warnrning: Invalid argument supplied for foreach() in /var/www/vhosts/CALTRADE.com/httpdocs/community/inc/classes/BxDolDb.php on line 372" --------
And also the following database errors:
-------- SELECT `ID`, `NickName` FROM `Profiles` LEFT JOIN `sys_acl_levels_members` ON ( `sys_acl_levels_members`.`IDLevel` = 4 ) WHERE `sys_acl_levels_members`.`IDMember` =
Mysql error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 4
Found error in the file '/var/www/vhosts/CALTRADE.com/httpdocs/community/inc/classes/BxDolPageView.php(572) : eval()'d code' at line 11. Called 'db_arr' function with erroneous argument #0. ---------
I tested the php blocks with "hello world" and they work, and I know okweb tests his mods well. so can anyone think of why these two mods won't play together?
Thanks
Rob
|
Hi Rob, can you post all the code you used
Ottar
|
Hi Ottar,
Here is the code as pasted in the php block (corrected from an earlier post):
$Memb = $this->iMember;
$MemLevelProfessional = 4;
$MemLevelBusiness = 5;
// Professional = IDLevel 4
$arr_Professional = db_arr( "SELECT `ID`, `NickName`
FROM `Profiles`
LEFT JOIN `sys_acl_levels_members` ON ( `sys_acl_levels_members`.`IDLevel` = $MemLevelProfessional )
WHERE `sys_acl_levels_members`.`IDMember` = $Memb
" );
if ( $arr_Professional )
{
echo "
<center><br>
<b>Hi {$arr_Professional[NickName]},</b>
Premium content only available to Professional Members.
</center><br>
";
}
// Business = IDLevel 5
$arr_Business = db_arr( "SELECT `ID`, `NickName`
FROM `Profiles`
LEFT JOIN `sys_acl_levels_members` ON ( `sys_acl_levels_members`.`IDLevel` = $MemLevelBusiness )
WHERE `sys_acl_levels_members`.`IDMember` = $Memb
" );
if ( $arr_Business )
{
echo "
<center><br>
<b>Hi {$arr_Business[NickName]},</b>
Premium content only available to Business Members.
</center><br>
";
}
|
You appear to be missing some code.
Near the top there must be something that fills the variable $Memb
The sql error shows that value as blank.
https://www.deanbassett.com |
ahhh - you are right, I seem to have left out the "$Memb = $this->iMember;" somehow. I will try it and report back here.
Sorry, I had pasted the wrong code in that post - it has now been edited and corrected. Do you see anything else?
|
I don't believe iMember is available everwhere. I believe it is dependent on what files were included on the page.
Instead of
$Memb = $this->iMember;
Try
$Memb = $_COOKIE['memberID'];
https://www.deanbassett.com |
Thank Deano, unfortunately I am still getting the errors but I think you are onto something. I forgot to mention that I was trying this technique on a new page I defined. I will try it on the accounts page as okweb originally recommended. |
Hi Deano,
Tried it on the accounts page this time, with both your code fix, and okweb's original code. I got the same error both times. The error appeared inside the php block itself.
Parse error: syntax error, unexpected T_DEC, expecting T_STRING or
T_VARIABLE or '$' in /var/www/vhosts/CALTRADE.com/httpdocs/community/inc/classes/BxDolPageView.php(572)
: eval()'d code on line 42
I don't think I got a database error this time.
Rob
UPDATE: OK, I think I got it working - I removed the spaces in that php and it started working, however it may have been a browser cache issue. Thanks for your help guys - I will keep you posted on this.
|
I have not added PHP-block to page builder on Dol.7.0.0, so I have not tested it in this version yet
will do it to morrow and see how it work.
Be sure var $MemLevelBusiness is not emty, check your DB table sys_acl_levels_members about you have a member with IDLevel = 4 if not you will you probably get a DB error!!
try this code:
$Memb = $this->iMember; $MemLevelBusiness = 4;
// Business = IDLevel 4
$arr_Business = db_arr( "SELECT `ID`, `NickName` FROM `Profiles` LEFT JOIN `sys_acl_levels_members` ON ( `sys_acl_levels_members`.`IDLevel` = $MemLevelBusiness ) WHERE `sys_acl_levels_members`.`IDMember` = $Memb " );
if ( $arr_Business ) {
echo "
<center><br><b>Hi {$arr_Business[NickName]},</b>Premium content only available to Business Members.</center><br> "; }
else
{ echo "
<center><br><b>You are Standard member: <a href=/modules/?r=membership/index/>Upgrade now</a></center><br> "; }
|
Ok, this thing has some unpredictable behavior, but I am beginning to understand it better. The reason the error messages stop, is that I was testing it from admin. If an external user goes to the page with this block, it will generate this error:
Database error in
Query:
SELECT `ID`, `NickName`
FROM `Profiles`
LEFT JOIN `sys_acl_levels_members` ON ( `sys_acl_levels_members`.`IDLevel` = 4 )
WHERE `sys_acl_levels_members`.`IDMember` =
Mysql error: You have an error in your SQL syntax; check the
manual that corresponds to your MySQL server version for the right
syntax to use near '' at line 4
Found error in the file '/var/www/vhosts/CALTRADE.com/httpdocs/community/inc/classes/BxDolPageView.php(572) : eval()'d code' at line 8. Called 'db_arr' function with erroneous argument #0.
By the way Ottar - if you are reading this (or anyone), where exactly does the "premium content" go? can I put html or an iframe in there someplace? I am going to switch to the first code for testing, with Deano cookie first line, to keep things simple.
Rob
|
Here's the latest - I have tried this code both with Deno's cookie, and without. It is currently showing the following error message either way. Code pasted below. Any ideas?
Parse error: syntax error, unexpected '>' in /var/www/vhosts/CALTRADE.com/httpdocs/community/inc/classes/BxDolPageView.php(572) : eval()'d code on line 18
----------------
Code currently being tested
$Memb = $_COOKIE['memberID'];
$MemLevelBusiness = 5;
// Business = IDLevel 5
$arr_Business = db_arr( "SELECT `ID`, `NickName`
FROM `Profiles`
LEFT JOIN `sys_acl_levels_members` ON ( `sys_acl_levels_members`.`IDLevel` = $MemLevelBusiness )
WHERE `sys_acl_levels_members`.`IDMember` = $Memb
" );
if ( $arr_Business )
{
echo "
<center><br>
<b>Hi {$arr_Business[NickName]},</b>
Premium content only available to Business Members.
</center><br>
else {
echo "
<center><br><b>
You are Standard member: <a href=/modules/?r=membership/index/>Upgrade now</a>
</b></center><br>
";
}
|
Here's the latest - I have tried this code both with Deno's cookie, and without. It is currently showing the following error message either way. Code pasted below. Any ideas?
Parse error: syntax error, unexpected '>' in /var/www/vhosts/CALTRADE.com/httpdocs/community/inc/classes/BxDolPageView.php(572) : eval()'d code on line 18
----------------
Code currently being tested
$Memb = $_COOKIE['memberID'];
$MemLevelBusiness = 5;
// Business = IDLevel 5
$arr_Business = db_arr( "SELECT `ID`, `NickName`
FROM `Profiles`
LEFT JOIN `sys_acl_levels_members` ON ( `sys_acl_levels_members`.`IDLevel` = $MemLevelBusiness )
WHERE `sys_acl_levels_members`.`IDMember` = $Memb
" );
if ( $arr_Business )
{
echo "
<center><br>
<b>Hi {$arr_Business[NickName]},</b>
Premium content only available to Business Members.
</center><br>
else {
echo "
<center><br><b>
You are Standard member: <a href=/modules/?r=membership/index/>Upgrade now</a>
</b></center><br>
";
}
Down at the bottom. Missing quotes in href.
Change this.
echo "
<center><br><b>
You are Standard member: <a href=/modules/?r=membership/index/>Upgrade now</a>
</b></center><br>
";
To this.
echo '
<center><br><b>
You are Standard member: <a href="/modules/?r=membership/index/">Upgrade now</a>
</b></center><br>
';
That might not fix it, but it's a problem area anyway.
Hard to see but don't forget to change the double " after the echo and before the last ; to single quotes. That has to be done because of the double quotes in the middle.
https://www.deanbassett.com |
Thanks Deno,
I pasted your code in there - still got a screen error, but a different one.
Rob
--------------
Parse error: syntax error, unexpected '?' in
/var/www/vhosts/CALTRADE.com/httpdocs/community/inc/classes/BxDolPageView.php(572)
: eval()'d code on line 19
|
I will have to setup a test machine again. I used my current test machine for something else. So i have to setup another one.
In order for me to run tests with your code i would have to duplicate all of your membership levels so there are some results to work with.
It will take me a day or so. Maybe okweb will jump in before i get something setup.
https://www.deanbassett.com |
Hi Rob
You can try my new code below,
Most of the error you have is because of how the content is saved to DB
like the code here, $Memb = $_COOKIE['memberID']; it will generate an error because it will look like this after you have saved it $Memb = $_COOKIE[''memberID''];
so you need to write this code like this $Memb = $_COOKIE[memberID]
New code to use inside Account page:
$Memb = $this->iMember; $siteurl = $site[url];
$MemLevelBusiness = 4; // Look at table sys_acl_levels about Business = ID 4 (need to be correct, if not edit it)
$arr_Business = db_arr( "SELECT `ID`, `NickName` FROM `Profiles` LEFT JOIN `sys_acl_levels_members` ON ( `sys_acl_levels_members`.`IDLevel` = $MemLevelBusiness ) WHERE `sys_acl_levels_members`.`IDMember` = $Memb " );
if ( $arr_Business ) { return <<<HTML <center><br><b>Hi {$arr_Business[NickName]}, </b>this content is only available to Business Members.</center><br> HTML; }
else { return <<<HTML <center><br><b><a href="{$siteurl}modules/?r=membership/index/">"Premium Content" - please upgrade.</a></b></center><br> HTML; }
|
Awesome Ottar, works like a charm. I have tested it with both a "business" level account - where the content shows, and a standard account - where it doesn't. Great job on this! (and thanks also to Dean for the php block).
Before I tried this on the account page though, I did try it on a page I had created called "trade opportunities". In this case, when you look at it while not logged in it does generate database errors. I wonder if this code can be modified so it works even for not logged in users?
Thanks a bunch for your help with this
Rob
Database error in
Query:
SELECT `ID`, `NickName` FROM `Profiles` LEFT JOIN `sys_acl_levels_members` ON ( `sys_acl_levels_members`.`IDLevel` = 5 ) WHERE `sys_acl_levels_members`.`IDMember` =
Mysql error: You have an error in your SQL syntax; check the
manual that corresponds to your MySQL server version for the right
syntax to use near '' at line 3
Found error in the file '/var/www/vhosts/CALTRADE.com/httpdocs/community/inc/classes/BxDolPageView.php(572) : eval()'d code' at line 7. Called 'db_arr' function with erroneous argument #0.
|
Well obviously the code will not work if the member is not logged in because it needs a member id to look up.
So, you can change the code so it does not execute if the member is not logged in.
Try adding the 2 lines marked in red.
$Memb = $this->iMember;
if ($Memb) {
$siteurl = $site[url];
$MemLevelBusiness = 4; // Look at table sys_acl_levels about Business = ID 4 (need to be correct, if not edit it)
$arr_Business = db_arr( "SELECT `ID`, `NickName` FROM `Profiles` LEFT JOIN `sys_acl_levels_members` ON ( `sys_acl_levels_members`.`IDLevel` = $MemLevelBusiness ) WHERE `sys_acl_levels_members`.`IDMember` = $Memb " );
if ( $arr_Business ) { return <<<HTML <center><br><b>Hi
{$arr_Business[NickName]}, </b>this content is only available to
Business Members.</center><br> HTML; }
else { return <<<HTML <center><br><b><a
href="{$siteurl}modules/?r=membership/index/">"Premium Content" -
please upgrade.</a></b></center><br> HTML; }
}
If the line if ($Memb) { does not work, you can try if (intval($Memb) > 0) { I am not sure what the exact value would be if a member is not logged in. I think its null. So the fist one should work.
https://www.deanbassett.com |
Hi Deano, no error message, so it may have worked, but also no "Premium content, please upgrade" message - there is just nothing there. I want them to know what they are missing. Is there a way to put that in the loop?
Thanks
Rob
|
Hi Deano, no error message, so it may have worked, but also no "Premium content, please upgrade" message - there is just nothing there. I want them to know what they are missing. Is there a way to put that in the loop?
Thanks
Rob
Yes, something can be displayed.
What do you want shown for those that are not logged in?
https://www.deanbassett.com |
"Premium content for members only" - something like that. |
Ok. Try this code.
$Memb = $this->iMember; if ($Memb) { $siteurl = $site[url]; $MemLevelBusiness = 4; // Look at table sys_acl_levels about Business = ID 4 (need to be correct, if not edit it)
$arr_Business = db_arr( "SELECT `ID`, `NickName` FROM `Profiles` LEFT JOIN `sys_acl_levels_members` ON ( `sys_acl_levels_members`.`IDLevel` = $MemLevelBusiness ) WHERE `sys_acl_levels_members`.`IDMember` = $Memb " );
if ( $arr_Business ) { return <<<HTML <center><br><b>Hi {$arr_Business[NickName]}, </b>this content is only available to Business Members.</center><br> HTML; }
else { return <<<HTML <center><br><b><a href="{$siteurl}modules/?r=membership/index/">"Premium Content" - please upgrade.</a></b></center><br> HTML; }
} else { return <<<HTML <center><br><b><a href="{$siteurl}member.php">Premium content for members only.</a></b></center><br> HTML; }
https://www.deanbassett.com |
I don't understand why you are doing a table JOIN.
sys_acl_levels_members has the member ID and membership level. Why do you need anything from the Profiles table?
You have the member ID, so its not like you have to lookup by NickName...
Light man a fire keep him warm for a night, light him ON fire & he will be warm the rest of his life |