Forum

Forum - DatingScript

Online dating software

You are not logged in.

#1 2019-03-15 18:11:07

lonelywolf
Member

profile field only for woman

Good day!
Is it possible for a certain user profile field to show only for women?

Offline

#2 2019-03-15 18:22:14

e7lew
Member

Re: profile field only for woman

yes, I did that only women see the hidden field from a regular group
so, by default, it's hidden from guests and regular users
when you create ex. skype field you can choose which user group has permission to see that field

Last edited by e7lew (2019-03-15 18:24:21)

Offline

#3 2019-03-15 18:39:03

lonelywolf
Member

Re: profile field only for woman

We are about the same fields?

Users - User types - Edit type - Members - Profile questions - New field ?

But I do not see such an opportunity. You probably modified the code?
I managed to achieve this, but only by adding a new type of users, and assigning it to all women, during registration. However, I am not sure that this is the right way.

Offline

#4 2019-03-15 18:55:10

e7lew
Member

Re: profile field only for woman

yes its modified  code

p_1169tryxp1.png

Offline

#5 2019-03-15 19:59:44

lonelywolf
Member

Re: profile field only for woman

Can you tell me which file to edit the code in? The code itself, I understand how it should look. But I can not find where to edit the code.

Offline

#6 2019-03-16 03:22:27

e7lew
Member

Re: profile field only for woman

Files:
public_html/application/views/system/elements/field/grid.php
public_html/application/views/system/elements/field/edit.php
/public_html/application/controllers/cp/system/fields/system.php

Offline

#7 2019-03-16 05:43:54

lonelywolf
Member

Re: profile field only for woman

Thank you very much!

Offline

#8 2019-03-20 07:12:20

lonelywolf
Member

Re: profile field only for woman

Good day!
I added a field mypaypal that should be available only to groups of women.
I managed to hide this field for all user groups, except for those I need, on the user profile page and on the profile editing page.

<? case 'textarea': ?>
	    <? if (  $field['keyword'] != 'mypaypal' ): ?>

		<? if ( isset($field['config']['wysiwyg']) && $field['config']['wysiwyg'] ): view::enableWYSIWYG(); endif; ?>

		<?=form_helper::textarea($name, form_helper::setValue($name, ( isset($value[$name]) ? $value[$name] : '' )), array(
			'class' => 'textarea '.( isset($field['class']) && $field['class'] ? $field['class'] : 'input-height-md' ).( isset($field['config']['wysiwyg']) && $field['config']['wysiwyg'] ? ' wysiwyg' . ( isset($field['config']['html']) && $field['config']['html'] ? ' html-' . $field['config']['html'] : '' ) : '' ),
			'data-images-embed-disable' => isset($field['config']['images_embed_disable']) && $field['config']['images_embed_disable'] ? 1 : 0,
			'data-images-upload-disable' => isset($field['config']['images_upload_disable']) && $field['config']['images_upload_disable'] || !config::item('plugins', 'core', 'pictures') ? 1 : 0,
			'placeholder' => ( isset($field['placeholder']) && $field['placeholder'] ? $field['placeholder'] : '' ),
			'id' => $id,
			'data-parent-id' => isset($extra['parent_id']) ? $extra['parent_id'] : '',
			'data-pictures-url' => isset($extra['pictures_url']) ? $extra['pictures_url'] : '',
		)) ?>
		<? else: ?>
		<? if (session::item('group_id') == 2): ?>
		<?=form_helper::textarea($name, form_helper::setValue($name, ( isset($value[$name]) ? $value[$name] : '' )), array(
			'class' => 'textarea '.( isset($field['class']) && $field['class'] ? $field['class'] : 'input-height-md' ).( isset($field['config']['wysiwyg']) && $field['config']['wysiwyg'] ? ' wysiwyg' . ( isset($field['config']['html']) && $field['config']['html'] ? ' html-' . $field['config']['html'] : '' ) : '' ),
			'data-images-embed-disable' => isset($field['config']['images_embed_disable']) && $field['config']['images_embed_disable'] ? 1 : 0,
			'data-images-upload-disable' => isset($field['config']['images_upload_disable']) && $field['config']['images_upload_disable'] || !config::item('plugins', 'core', 'pictures') ? 1 : 0,
			'placeholder' => ( isset($field['placeholder']) && $field['placeholder'] ? $field['placeholder'] : '' ),
			'id' => $id,
			'data-parent-id' => isset($extra['parent_id']) ? $extra['parent_id'] : '',
			'data-pictures-url' => isset($extra['pictures_url']) ? $extra['pictures_url'] : '',
		)) ?>
           	<? endif; ?>
			<? endif; ?>
		<? break; ?>

But I can not hide the label Paypal for this field. It is shown to all. And I can not find the file that is responsible for the output of this label.
The logic tells me that this element should be in the same file:
public_html / application / views / system / elements / field / edit.php
But it seems that it is not?

Offline

#9 2019-03-25 18:04:53

lonelywolf
Member

Re: profile field only for woman

OK. I found the solution myself. If someone needs something to do something like that, I tell you how.
It turned out that I was trying to realize my plan simply by editing the wrong file. In fact, this file does not need to be affected at all, and you need to edit the file:
/ application / views / system / elements / edit.php
We create in the admin panel a new text field that needs to be displayed, only for users from groups with id=2 and id=3. My field has a keyword mypaypal
Open the file
/ application / views / system / elements / edit.php
Find:

<? else: if ( $field['type'] == 'select' && ( !isset($select) || $select ) ) $field['select'] = true; ?>

	<div class="control" id="input_row_<?=$type?>_<?=( isset($field['system']) ? 'data_' : '' )?><?=$field['keyword']?>">

		<label for="input_edit_<?=$type?>_<?=( isset($field['system']) ? 'data_' : '' )?><?=$field['keyword']?>">
			<?=(isset($field['name']) ? $field['name'] : '')?> <? if ( isset($field['required']) && $field['required'] ): ?><span class="required">*</span><? endif; ?>
		</label>

		<div class="field">

			<? view::load('system/elements/field/edit', array(
				'prefix' => $type,
				'field' => $field,
				'value' => isset($value) ? $value : '',
				'extra' => isset($extra) ? $extra : array(),
			)) ?>

		</div>

	</div>

<? endif; ?>

replace with

<? else: if ( $field['type'] == 'select' && ( !isset($select) || $select ) ) $field['select'] = true; ?>

	<div class="control" id="input_row_<?=$type?>_<?=( isset($field['system']) ? 'data_' : '' )?><?=$field['keyword']?>">
         <? if (  $field['keyword'] != 'mypaypal' ): ?>
		<label for="input_edit_<?=$type?>_<?=( isset($field['system']) ? 'data_' : '' )?><?=$field['keyword']?>">
			<?=(isset($field['name']) ? $field['name'] : '')?> <? if ( isset($field['required']) && $field['required'] ): ?><span class="required">*</span><? endif; ?>
		</label>
		<? else: ?>
	    <? if (session::item('group_id') == 2 || session::item('group_id') == 3): ?>
	    <label for="input_edit_<?=$type?>_<?=( isset($field['system']) ? 'data_' : '' )?><?=$field['keyword']?>">
			<?=(isset($field['name']) ? $field['name'] : '')?> <? if ( isset($field['required']) && $field['required'] ): ?><span class="required">*</span><? endif; ?>
		</label>
		 <? else: ?>
	     <? endif; ?>
	     <? endif; ?>

         <? if (  $field['keyword'] != 'mypaypal' ): ?>
		<div class="field">

			<? view::load('system/elements/field/edit', array(
				'prefix' => $type,
				'field' => $field,
				'value' => isset($value) ? $value : '',
				'extra' => isset($extra) ? $extra : array(),
			)) ?>

		</div>
		<? else: ?>
	    <? if (session::item('group_id') == 2 || session::item('group_id') == 3): ?>
        <div class="field">

			<? view::load('system/elements/field/edit', array(
				'prefix' => $type,
				'field' => $field,
				'value' => isset($value) ? $value : '',
				'extra' => isset($extra) ? $extra : array(),
			)) ?>

		</div>
		<? else: ?>
	     <? endif; ?>
	     <? endif; ?>

	</div>

<? endif; ?>

We save. That's all. Now the field mypaypal will be shown only in the profile of users from groups with id 2 and 3

Last edited by lonelywolf (2019-03-25 18:09:19)

Offline

#10 2019-03-26 11:50:02

e7lew
Member

Re: profile field only for woman

good but
This code is incomplete
How will visitors know that there is a hidden code?
Or how will other groups of members know there is a hidden field?
Where is the hidden message next to the field?
In this case, the hidden field becomes useless

The trick is to make visitors register and pay
This is the idea of hiding the field

Offline

#11 2019-03-26 17:04:59

lonelywolf
Member

Re: profile field only for woman

Not quite right. In my case, I just needed to make a field in the user profile that would be available only to women. User groups with id 2 and 3 are groups in which there are only women. Accordingly, a woman, editing a profile, sees one field more than a man. And when viewing a profile, respectively, this field is displayed only for women. And only those who have filled it. I achieved my goal.

Offline

#12 2019-03-28 10:19:23

littlebit
Member

Re: profile field only for woman

Any suggestions how to add code for displaying "Hidden, please upgrade" with upgradelink to this example ?

Offline

Board footer