1

JFormFieldUser::getInput を Joomla フォームへの入力として使用しようとしています。

バックエンド (スーパー ユーザーでログイン) でこのメソッドを呼び出すと、クリックすると適切な「ユーザーの選択」ボックスが生成され、選択するすべてのユーザーのリストが表示されます。

フロントエンドフォーム(スーパーユーザーでログイン)でユーザーフォームフィールドを使用しようとしています。その結果、ややこしくて望ましくないものになります。「ユーザーの選択」リンクが生成されますが、それをクリックすると、すべてのユーザーのリストではなく、スーパー ユーザーの「ユーザー プロファイル」が読み込まれます。

これはなぜですか。バックエンドで行うように、「ユーザーの選択」でユーザーの完全なリストを表示するにはどうすればよいですか。

4

4 に答える 4

1

Joomla 3 (フィールド定義から):

     <field name="field_name" type="sql" label="COM_FIELD_LABEL"
        sql_select="id,name"
        sql_from="#__users"
        value_field="name"
        key_field="id"
        description="" 
        header="DROP_DOWN_HEADER"
        required="false" />
于 2016-06-16T20:54:49.590 に答える
0

私はこれであまり運がありませんでした。代わりに、独自のコンポーネントを作成し、com_users のコンテンツを追加しました。御馳走を働いた。

于 2012-10-11T17:09:43.500 に答える
0

どうやら出来ないらしい

JForm (Joomla) User フィールドは、Joomla 記事フォームでユーザーを選択するために表示される Joomla コア フィールドです (ユーザーのリストを含むライトボックス)。Joomla コアがフロントエンドで管理しないため、このフィールドをフロントエンドで使用できないことに注意してください... 多くの場合、フロントエンドでこのフィールドを選択動的フィールドに置き換えます。

于 2014-06-16T13:20:36.903 に答える
0

Can be done fairly simply but with some significant limitations - depending on your use case.

  • User must be logged in to backend (even if you are trying to access the information frontend). If they are not logged in, it will prompt for log in and break out of the modal :(
  • User must have permissions for User Manager

Then duplicate the \libraries\cms\form\field\user.php to a fields location of your choice (in a modal subdirectory) and rename it to something like user2.php. Make the class name JFormFieldModal_Users2 and the $type='Modal_Users2'.

Don't forget to add the new path to your form .xml if required. The type will be "modal_users2".

Last step. In user2.php, change:

    $link     = 'index.php?option=com_users&amp;view=users&amp;layout=modal&amp;tmpl=component&amp;field=' . $this->id
            . (isset($groups) ? ('&amp;groups=' . base64_encode(json_encode($groups))) : '')
            . (isset($excluded) ? ('&amp;excluded=' . base64_encode(json_encode($excluded))) : '');

to

    $link     = 'administrator/index.php?option=com_users&amp;view=users&amp;layout=modal&amp;tmpl=component&amp;field=' . $this->id
            . (isset($groups) ? ('&amp;groups=' . base64_encode(json_encode($groups))) : '')
            . (isset($excluded) ? ('&amp;excluded=' . base64_encode(json_encode($excluded))) : '');

A bit hacky, but served my purposes.

Less hacky, but less glamorous solution here: The SQL formfield type

于 2015-08-09T16:47:46.357 に答える