-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnw_codec.text
84 lines (52 loc) · 2.43 KB
/
nw_codec.text
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
NetWrap Codec
Functions:
<!--get_user function-->
The get_user() function retrieves the display Name from the nw_users table.
EXAMPLE:
<?php echo get_user($user_ID);?>
the example over will display something like this: John Doe.
<!--get_usermeta function-->
The get_usermeta() function retrieves the meta_value from the nw_usermeta table.
Pass the following values into the function: get_usermeta('user_id', 'meta_key').
EXAMPLE:
<?php echo get_usermeta($user_ID, 'nw_user_level');?>
The example above will return the user level of the user id you pass into the function.
There are three levels in Netwrap.
- Administrator = userlevel 3
- Editor = userlevel 2
- Poster = userlevel 1
You can change the second parameter to match the meta_key you want to retrieve
Meta keys are:
- nw_user_level = userlevel
-
<!--
-
- Functions to create elements
-
--!>
<!--add_editor()-->
The add_editor returns a fully functional tinyMCEditor.
Pass the following values into the function: add_editor('editor_id', 'editor_name')
Both editor_id and editor_name needs to be unique, so using a slug or prefix is highly recommended.
EXAMPLE:
<?php echo add_editor('my_editor_id', 'my_editor_name');?>
The example above will output a TinyMCEditor with the id 'editor_id', and form control name 'editor_name'.
To get the output of the form simply call the for with JavaScript on the editor_id you selected, or by calling it with $_POST['editor_id'].
<!-- add_form_start()-->
The add_form_start is simply a function to start a form around an editor. This function is only used when a add_editor function is used.
EXAMPLE:
<?php add_form_start('same_id_as_editor', 'same_name_as_editor'); ?>
// and here you start the editor.
<?php echo add_editor('editor_id', 'editor_name');?>
PS: Remember to close the form of at the end. Use the standar </form> tag.
<!--add_metabox_top()-->
The add_metabox_top adds the top of the metabox. This function can take two arguments.
add_metabox_top($header_title, $metabox_size).
The first argument is the header title of the metabox, the secound argument is the size.
There are six sizes: tiney, small, medium, medium+, medium++, large.
!IMPORTANT - In order for the metabox to show you also need to add add_metabox_bottom() function.
EXAMPLE:
<?php add_metabox_top('my metabox', 'large');?>
//The content of the metabo goes here.
This can be any html code, javascript or php code.
<?php add_metabox_bottom();?>