Jump to content

Permissions on database/pages


Recommended Posts

I have several databases which are used for Tutorials, Tools and Calculators etc which I want to provide only to registered logged in users. However, to entice people to register on a site you need to show them what they are missing out on by not registering. The issue with the permissions on databases/pages is to stop Guests from accessing individual records you can't show them a page listing the records that they are missing out on.

For example in my case I want to show them what is available to them if they registered:

1.thumb.jpg.2196d747c4783a3fbc4a380d0b75b791.jpg

BUT NOT allow them them to see/use the actual record (in this case a form tool):

2.thumb.jpg.dae2f600b36df53f72bfd8c98becd41d.jpg

If you set the database/pages permissions so that Guests can't access the individual records in the database all they see is:

3.thumb.jpg.95a0a282651316bfd35ed809243bd66a.jpg

Which does nothing to entice them to register because they have no idea what they are missing out on and what the site provides.

Any thoughts on how I could fix this...like for example could I leave Guests with permissions to view but put in the actual record template an "If usergroup = Guest, display msg to view please register"...a bit messy so any other ideas...thanks

(I think IPS needs to add an extra level of permissions in many areas of the suite to help site owners grow their sites)

Edited by ibaker
Link to comment
Share on other sites

1 hour ago, Morrigan said:

Do it at the field level instead of at the article level. So edit the permissions of the fields and create a special “guest teaser” field. This field only shows to guests while the others don’t.

I tried that, maybe I am doing something wrong but I edited the "Content" field permissions and it made no difference:

1.thumb.jpg.845b48e7dbb067085ae499bdeb85687d.jpg

Link to comment
Share on other sites

I have done it this way:

A guest user sees all the records in the database landing page (note I use an addon to display the individual records with an image in this screen shot):

1.thumb.jpg.2608cade766560cc5dc3facf99b6a986.jpg

And when a Guest clicks on one of the records to view it what they see is:

2.thumb.jpg.ec915a5028a09c8f8dac07e5f5520cb2.jpg

To help everyone else that may need this type of permissions for a database/page this what I have done:

1. In Page management create a copy of the Display template group and name the group what you like

2. In the record template of the group add the following code at the very top of the template:

{{if !\IPS\Member::loggedIn()->member_id}}
	<div class='ipsPageHeader ipsBox ipsResponsive_pull ipsPadding ipsClearfix'>
		<div class='ipsFlex ipsFlex-ai:center ipsFlex-fw:wrap ipsGap:4'>
			<div class='ipsFlex-flex:11'>
				<h1 class='ipsType_pageTitle ipsContained_container'>Registered Users Only</h1>
				<div data-controller="core.global.core.login">
					<input type="hidden" name="csrfKey" value="{expression="\IPS\Session::i()->csrfKey"}">
					{{if \IPS\Login::registrationType() != 'disabled'}}
						<div class='ipsType_center ipsPad cGuestTeaser'>
							<div class='ipsBox ipsPad ipsSpacer_top'>
								<div class='ipsGrid ipsGrid_collapsePhone'>
									<div class='ipsGrid_span6 cGuestTeaser_left'>
										<h2 class='ipsType_sectionHead'>{lang="teaser_account"}</h2>
										<p class='ipsType_normal ipsType_reset ipsType_light ipsSpacer_bottom'>{lang="teaser_account_desc"}</p>
										{{if \IPS\Login::registrationType() == 'redirect'}}
											<a href='{expression="\IPS\Settings::i()->allow_reg_target"}' class='ipsButton ipsButton_primary ipsButton_small' target="_blank" rel="noopener">
										{{else}}
											<a href='{url="app=core&module=system&controller=register" seoTemplate="register"}' class='ipsButton ipsButton_primary ipsButton_small' {{if \IPS\Login::registrationType() == 'normal'}}data-ipsDialog data-ipsDialog-size='narrow' data-ipsDialog-title='{lang="sign_up"}'{{endif}}>
										{{endif}}
										{lang="teaser_account_button"}</a>
									</div>
									<div class='ipsGrid_span6 cGuestTeaser_right'>
										<h2 class='ipsType_sectionHead'>{lang="teaser_signin"}</h2>
										<p class='ipsType_normal ipsType_reset ipsType_light ipsSpacer_bottom'>{lang="teaser_signin_desc"}</p>
										<a href='{url="app=core&module=system&controller=login" seoTemplate="login" $item->url() . '#replyForm'"}' data-ipsDialog data-ipsDialog-size='medium' data-ipsDialog-remoteVerify="false" data-ipsDialog-title="{lang="teaser_signin_button"}" class='ipsButton ipsButton_primary ipsButton_small'>{lang="teaser_signin_button"}</a>
									</div>
								</div>
							</div>
						</div>
					{{endif}}
				</div>
			</div>
		</div>
	</div>
{{else}}

and don't forget to add {{endif}} at the very bottom of the template as well

3. Open the settings of your database and in the field "Display Template Group" select the name you gave the group in Step 1 above.

Hope this helps

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...